焦点图
UIScrollPicture 是一个图片轮播模块,只需传入一组图片地址,即可实现图片轮播效果。
function Scroll(){
banner = $api.byId('banner')
,bannerH = $api.offset(banner).h;
var UIScrollPicture = api.require('UIScrollPicture');
UIScrollPicture.open({
rect: {
x: 0,
y: 0,
w: api.winWidth,
h: bannerH
},
data: {
paths: [
'http://dyh.chinadatatrading.com/static/img/b1.jpg',
'http://dyh.chinadatatrading.com/static/img/b2.jpg'
],
captions: []
},
styles: {
caption: {},
indicator: {
align: 'center',
color: '#fff',
activeColor: '#d0cdd1'
}
},
placeholderImg: 'http://img.lanrentuku.com/img/allimg/1212/5-121204193935-51.gif',
contentMode: 'scaleToFill',
interval: 3,
fixedOn: api.frameName,
loop: true,
fixed: false
}, function(ret, err) {
if (ret) {
// alert(JSON.stringify(ret));
} else {
// alert(JSON.stringify(err));
}
});
}