如何创建一个自动旋转的项目容器,并在鼠标悬停时停止

时间:2014-02-11 23:38:12

标签: jquery html css twitter-bootstrap-3

       <div class="part-1 content">
            <div class="container">
                <div class="row">
                    <div class="col-sm-2">
                        <img src="images/sc/part-1-alt.png" class="img-responsive" alt="a" data-toggle="tooltip" title="Donec id elit non mi porta loreta et">
                    </div>

                    <div class="col-sm-2">
                        <img src="images/sc/part-2.png" class="img-responsive" alt="a" data-toggle="tooltip" title="Donec id elit non mi porta loreta et">
                    </div>

                    <div class="col-sm-2">
                        <img src="images/sc/part-3.png" class="img-responsive" alt="a" data-toggle="tooltip" title="Donec id elit non mi porta loreta et">
                    </div>

                    <div class="col-sm-2">
                        <img src="images/sc/part-4.png" class="img-responsive" alt="a" data-toggle="tooltip" title="Donec id elit non mi porta loreta et">
                    </div>

                    <div class="col-sm-2">
                        <img src="images/sc/part-5.png" class="img-responsive" alt="a" data-toggle="tooltip" title="Donec id elit non mi porta loreta et">
                    </div>

                    <div class="col-sm-2">
                        <img src="images/sc/part-6-alt.png" class="img-responsive" alt="a" data-toggle="tooltip" title="Donec id elit non mi porta loreta et">
                    </div>
                </div>
            </div>
        </div>

这是我想要表现的元素。我想要的是让它看起来像你在新闻上看到的乐队,当我将鼠标悬停在它上面时移动和停止。我正在使用bootstrap 3,如果它可以在它的旋转木马内完成那将是很棒的。我在问这个之前做了一些搜索,但我真的找不到任何相关内容,所以请原谅我,如果这实际上是另一个措辞不同的问题的副本

1 个答案:

答案 0 :(得分:0)

哦,它被称为无限循环轮播,并且您可以选择指定要触发暂停的事件:http://getbootstrap.com/2.3.2/javascript.html#carousel

$('.carousel').carousel({
  interval: 2000,
  pause: 'hover' 
 /*Pauses the cycling of the carousel on mouseenter 
 and resumes the cycling of the carousel on mouseleave. */
})