亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

swiper怎么樣實現勻速輪播,中間不停留

swiper怎么樣實現勻速輪播,中間不停留

吃雞游戲 2018-10-10 20:19:42
http://www.16sucai.com/upload...就是實現類似這種的效果,我覺得應該可以實現吧,求解
查看完整描述

1 回答

?
回首憶惘然

TA貢獻1847條經驗 獲得超11個贊

請按F12自己看~

代碼如下:

// JavaScript Document

(function($){

    $.fn.myScroll = function(options){

    //默認配置

    var defaults = {

        speed:40,  //滾動速度,值越大速度越慢

        rowHeight:24 //每行的高度

    };

    

    var opts = $.extend({}, defaults, options),intId = [];

    

    function marquee(obj, step){

    

        obj.find("ul").animate({

            marginTop: '-=1'

        },0,function(){

                var s = Math.abs(parseInt($(this).css("margin-top")));

                if(s >= step){

                    $(this).find("li").slice(0, 1).appendTo($(this));

                    $(this).css("margin-top", 0);

                }

            });

        }

        

        this.each(function(i){

            var sh = opts["rowHeight"],speed = opts["speed"],_this = $(this);

            intId[i] = setInterval(function(){

                if(_this.find("ul").height()<=_this.height()){

                    clearInterval(intId[i]);

                }else{

                    marquee(_this, sh);

                }

            }, speed);


            _this.hover(function(){

                clearInterval(intId[i]);

            },function(){

                intId[i] = setInterval(function(){

                    if(_this.find("ul").height()<=_this.height()){

                        clearInterval(intId[i]);

                    }else{

                        marquee(_this, sh);

                    }

                }, speed);

            });

        

        });


    }


})(jQuery);


查看完整回答
反對 回復 2018-11-13
  • 1 回答
  • 0 關注
  • 2927 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號