手机端轮播图插件

手机端轮播图实现:

 

 

 

对应插件:af.carousel.js 见附件

 

使用方法:

/***
 *
 * @param carouselId
 * @param carousel_dotsId
 * @param autoPlay : 是否自动播放轮播图
 * @param isCache : 不传值默认为true
 */
function carouselSetup(carouselId, carousel_dotsId, autoPlay, isCache) {
    // set size of carousel
    $(".carousel").width($(".carousel").closest(".panel").width());
//    $("#carousel").height($("#carousel").closest(".panel").height()-25);
    var moveCallback = function () {
        console.log(arguments);
    }
    var options={
        vertical:false, // page up/down
        horizontal:true, // page left/right
        pagingDiv:carousel_dotsId, // div to hold the dots for paging
        pagingCssName:"carousel_paging", //classname for the paging dots
        pagingCssNameSelected: "carousel_paging_selected", //classname for the selected page dots
        wrap:true, //Creates a continuous carousel
        okToMove:true,
        pagingDotDivHeight:'10px',
        //isCache: false,
        moveCallback2/* this.carouselIndex, this.myDivHeight, this.myDivWidth, this.el.children */: moveCallback,
        autoTransitionIntervalTime:4000
    }
    if (arguments.length > 3 && !isCache) {
        options.isCache = false;
    }
    var carousel = $("#"+carouselId).carousel(options);
    if(arguments.length>2&&autoPlay){
        carousel.switchAuto();//自动播放
    }
}

 

carouselSetup("pic_news_carousel", "carousel_dots_picnews", false, false);

 

 

carouselSetup("index_carousel","carousel_dots",true);//轮播图

 

实例:http://123.57.250.51/ios_www/www/index.html (请用手机访问)



 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值