Preventing twitter bootstrap carousel from auto sliding on page load

后端 未结 10 1702
萌比男神i
萌比男神i 2020-12-07 17:13

So is there anyway to prevent twitter bootstrap carousel from auto sliding on the page load unless the next or previous button is clicked?

Thanks

相关标签:
10条回答
  • 2020-12-07 17:40

    Below are the list of parameters for bootstrap carousel. Like Interval, pause, wrap:

    For more details refer this link:

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

    Hope this will help you :)

    Note: This is for further help. I mean how you can customise or change default behaviour once carousel is loaded.

    0 讨论(0)
  • 2020-12-07 17:43

    Or if you're using Bootstrap 3.0 you can stop the cycling with data-interval="false" for instance

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

    Other helpful carousel data attributes are here -> http://getbootstrap.com/javascript/#carousel-usage

    0 讨论(0)
  • 2020-12-07 17:43

    Actually, the problem is now solved. I added the 'pause' argument to the method 'carousel' like below:

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

    Anyway, thanks so much @Yohn for your tips toward this solution.

    0 讨论(0)
  • 2020-12-07 17:43

    --Use data-interval="false" to stop automatic slide --Use data-wrap="false" to stop circular slide

    ...
    0 讨论(0)
  • 2020-12-07 17:46
    • Use data-interval="false" to stop automatic slide
    • Use data-wrap="false" to stop circular slide
    0 讨论(0)
  • 2020-12-07 17:50

    The problem with carousel automatically sliding after prev/next button press is solved.

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

    GitHub commit 78b927b

    0 讨论(0)
提交回复
热议问题