Doug Smith
Doug Smith

Reputation: 29316

Twitter Bootstrap carousel is not pausing on hover/mouse-over

Code:

<html>
<head>
    <link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/css/bootstrap.no-icons.min.css" rel="stylesheet">
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
    <script src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.1/js/bootstrap.min.js"></script>        
    <script>
      $(document).ready(function(){
        $('#welcome-carousel').carousel({
          interval: 5000,
        });
      });
    </script>
</head>

<body><div style="width:600px;margin:auto;">
    <div id="welcome-carousel" class="carousel slide"><!-- class of slide for animation -->
      <div class="carousel-inner">
        <div class="item active"><!-- class of active since it's the first item -->
          <img src="img/image1.png" alt="" />
        </div>
        <div class="item">
          <img src="img/image4.png" alt="" />
        </div>
        <div class="item">
          <img src="img/image3.png" alt="" />
          <div class="carousel-caption">
            <p>Hello to the WORLD!</p>
          </div>
        </div>
        <div class="item">
          <img src="img/image2.png" alt="" />
        </div>
        <div class="item">
          <img src="img/image1.png" alt="" />
        </div>
      </div><!-- /.carousel-inner -->
      <!--  Next and Previous controls below
            href values must reference the id for this carousel -->
        <a class="carousel-control left" href="#welcome-carousel" data-slide="prev">&lsaquo;</a>
        <a class="carousel-control right" href="#welcome-carousel" data-slide="next">&rsaquo;</a>
    </div>
    </div>
    <p>hey</p>
</body>

If I hover over the slideshow, it won't stop the slideshow. Why?

Upvotes: 4

Views: 13791

Answers (2)

Yohn
Yohn

Reputation: 2559

we just found a bug within the carousel with bootstrap 2.2.1 where the carousel doesnt pause on hover when you mouseover the carousel in the middle of a slide / transition. You can see more on this issue here - https://github.com/twitter/bootstrap/issues/5747

Upvotes: 7

nickhar
nickhar

Reputation: 20823

Try (in your case):

  $(document).ready(function(){
    $('#welcome-carousel').carousel({
      interval: 5000,
      pause: "hover"
    });
  });

As per docs at: http://twitter.github.com/bootstrap/javascript.html#carousel

Upvotes: 12

Related Questions