首页 文章

防止Twitter引导轮播在页面加载时自动滑动

提问于
浏览
111

因此,除非单击下一个或上一个按钮,否则无论如何都要阻止Twitter引导程序轮播在页面加载时自动滑动?

谢谢

10 回答

  • 245

    或者,如果您使用的是Bootstrap 3.0,则可以使用data-interval =“false”来停止循环

    <div id="carousel-example-generic" class="carousel slide" data-interval="false">

    其他有用的轮播数据属性在这里 - > http://getbootstrap.com/javascript/#carousel-usage

  • 5

    实际上,问题现在已经解决了 . 我将'pause'参数添加到方法'carousel'中,如下所示:

    $(document).ready(function() {      
       $('.carousel').carousel('pause');
    });
    

    无论如何,非常感谢@Yohn提供有关此解决方案的提示 .

  • 1

    解决了在上一次/下一次按钮按下后旋转木马自动滑动的问题 .

    $('.carousel').carousel({
        pause: true,
        interval: false
    });
    

    GitHub commit 78b927b

  • 17

    如果你在旋转木马的HTML结构上使用 bootstrap 3 set data-interval="false"

    例:

    <div id="carousel-example-generic" class="carousel slide" data-ride="carousel" data-interval="false">
    
  • 1
    • 使用 data-interval="false" 停止自动滑动

    • 使用 data-wrap="false" 停止循环滑动

  • 10

    将此添加到您的coursel div:

    data-interval="false"
    
  • 10

    以下是bootstrap轮播的参数列表 . 像Interval一样,暂停,换行:

    enter image description here

    有关详细信息,请参阅此链接:

    http://www.w3schools.com/bootstrap/bootstrap_ref_js_carousel.asp

    希望对你有帮助 :)

    Note: 这是为了进一步的帮助 . 我的意思是如何在加载轮播后自定义或更改默认行为 .

  • 2

    我想也许你应该去检查关于旋转木马的官方说明,对我来说,我还没有找到上面的答案,因为有多个版本的bootstrap,我正在使用b4-alpha和 i want the autoplay effect stop.

    $(document).ready({
        pause:true,
        interval:false
    });
    

    当鼠标离开那个页面时,这个脚本没有任何效果,完全是轮播区域 . 去官方定义并找到那些:

    enter image description here

    所以你会发现why.if轮播页面onmouseover事件被触发,页面将暂停,而鼠标离开该页面,它将再次恢复 .

    So, if you want a page stop forever and rotate manually ,你可以设置 data-interval='false' .

  • 52
    • 使用data-interval =“false”停止自动滑动 - 使用data-wrap =“false”停止循环滑动
      ...
  • 41

    对于Bootstrap 4,只需从旋转木马div中删除'data-ride =“carousel”' . 这会在加载时删除自动播放 .

    要再次启用自动播放,您仍然需要在javascript中使用“播放”调用 .

相关问题