【问题标题】:Auto sliding photos jQuery image slider自动滑动照片 jQuery 图像滑块
【发布时间】:2014-07-18 22:42:17
【问题描述】:

我有这个脚本,它在单击下一个箭头转到下一张照片时运行一个函数。

<script src="js/jquery.cbpFWSlider.min.js"></script>

我怎样才能自动调用这个函数或其他什么来滑动照片?

        $( function() {
            $( '#cbp-fwslider' ).cbpFWSlider( {speed : 1200, easing : 'ease'});
        } );

另外我该如何修改 easing : 'ease' 参数。到其他值?

【问题讨论】:

    标签: javascript jquery


    【解决方案1】:

    这对我有用。你可以在这里找到答案Autoplay JQuery slideshow Using cbpFWSlider

    $('document').ready(function(){
                    // init slider
                    $('#cbp-fwslider').cbpFWSlider();
    
                   /**
                         Set a 3 seconds interval
                         if next button is visible (so is not the last slide)  click next button
                         else it finds first dot and click it to start from the 1st slide
                    **/
                    setInterval( function(){
                        if($('.cbp-fwnext').is(":visible"))
                            {
                                $('.cbp-fwnext').click();   
    
    
                    }
                    else{
                            $('.cbp-fwdots').find('span').click();
                        }
                } ,3000 );
            });
    

    【讨论】:

      【解决方案2】:

      我不知道这是否是获得所需结果的最有效方式,但请尝试使用window.setInterval( func, delay );,延迟以毫秒为单位。

      【讨论】:

      • 谢谢你,但我会试试别的。
      【解决方案3】:

      该插件使用 easing 选项将 CSS3 属性“transition-timing-function”应用于函数。要更改缓动值,请指定另一个有效值。

      请参阅 http://www.w3schools.com/cssref/css3_pr_transition-timing-function.asp 作为参考。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-01-28
        • 2017-03-23
        • 2012-07-15
        • 2016-02-09
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多