我想知道如何停止无限自动滚动,当单击向右箭头时它会按页显示而不是按元素显示?
$('.carousel.carousel-multi .item').each(function () {
var next = $(this).next();
if (!next.length) {
next = $(this).siblings(':first');
}
next.children(':first-child').clone().attr("aria-hidden", "true").appendTo($(this));
if (next.next().length > 0) {
next.next().children(':first-child').clone().attr("aria-hidden", "true").appendTo($(this));
}
else {
$(this).siblings(':first').children(':first-child').clone().appendTo($(this));
}
});
最佳答案
如果您不想无限自动滚动,只需添加:
data-interval="false"
只需这样做:
<div class="carousel slide" data-ride="carousel" data-type="multi" data-interval="false" id="myCarousel">
这是一个可行的解决方案。希望对您有所帮助!
这是工作解决方案的链接: http://codepen.io/HenryGranados/pen/KWLweQ
关于javascript - 元素轮播 Bootstrap ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43220917/