admin管理员组文章数量:1415467
Here's my markup:
<div id="carousel-example-generic" class="carousel slide" data-interval="false" data-pause="hover">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#carousel-example-generic" data-slide-to="0"></li>
<li data-target="#carousel-example-generic" data-slide-to="1"></li>
<li data-target="#carousel-example-generic" data-slide-to="2"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner">
<div class="item active">
<div style="height:200px;">Slide 1</div>
<div class="carousel-caption">
...
</div>
</div>
<div class="item">
<div style="height:200px;">Slide 2</div>
<div class="carousel-caption">
...
</div>
</div>
<div class="item ">
<div style="height:200px;">Slide 3</div>
<div class="carousel-caption">
...
</div>
</div>
</div>
<!-- Controls -->
<a class="left carousel-control" href="#carousel-example-generic" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
</a>
<a class="right carousel-control" href="#carousel-example-generic" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
</a>
</div>
I am using bootstrap v3.0.3, and yet the carousel still starts scrolling after page is loaded. I have also tried including:
$(function () {
$(".carousel").carousel({ interval: false });
});
I've done this with and without the data-interval
attribute, all to no avail. The carousel automatically starts scrolling after page is loaded. I have seen other questions about this but they were all referring to older version and implied it has been fixed by now.
Any ideas please?
Here's my markup:
<div id="carousel-example-generic" class="carousel slide" data-interval="false" data-pause="hover">
<!-- Indicators -->
<ol class="carousel-indicators">
<li data-target="#carousel-example-generic" data-slide-to="0"></li>
<li data-target="#carousel-example-generic" data-slide-to="1"></li>
<li data-target="#carousel-example-generic" data-slide-to="2"></li>
</ol>
<!-- Wrapper for slides -->
<div class="carousel-inner">
<div class="item active">
<div style="height:200px;">Slide 1</div>
<div class="carousel-caption">
...
</div>
</div>
<div class="item">
<div style="height:200px;">Slide 2</div>
<div class="carousel-caption">
...
</div>
</div>
<div class="item ">
<div style="height:200px;">Slide 3</div>
<div class="carousel-caption">
...
</div>
</div>
</div>
<!-- Controls -->
<a class="left carousel-control" href="#carousel-example-generic" data-slide="prev">
<span class="glyphicon glyphicon-chevron-left"></span>
</a>
<a class="right carousel-control" href="#carousel-example-generic" data-slide="next">
<span class="glyphicon glyphicon-chevron-right"></span>
</a>
</div>
I am using bootstrap v3.0.3, and yet the carousel still starts scrolling after page is loaded. I have also tried including:
$(function () {
$(".carousel").carousel({ interval: false });
});
I've done this with and without the data-interval
attribute, all to no avail. The carousel automatically starts scrolling after page is loaded. I have seen other questions about this but they were all referring to older version and implied it has been fixed by now.
Any ideas please?
Share Improve this question edited Jan 1, 2014 at 22:22 hkk 2,1491 gold badge26 silver badges48 bronze badges asked Jan 1, 2014 at 21:07 codedogcodedog 2,5089 gold badges39 silver badges67 bronze badges 3- 1 Seems to work fine on 3.0.3 - bootply./103352 Do you have any other JavaScript code or other carousels on the same page? – Carol Skelly Commented Jan 1, 2014 at 21:50
- 1 You are absolutely right! There were some scripts for other plugins referenced before my script. They were leftovers from another site I built some time ago. The perils of copy'n'paste! It works just fine thanks :) What's the mon practice here? I can't vote your ment as an answer. Do I just delete this question? – codedog Commented Jan 1, 2014 at 21:57
- I added my ment as an solution/answer. Pls accept so that others know your question is resolved. Thanks! – Carol Skelly Commented Jan 1, 2014 at 22:17
1 Answer
Reset to default 1Your carousel markup is correct for 3.0.3 (http://bootply./103352)
Make sure there is not other JavaScript code or other carousels on the same page.
本文标签: javascriptBootstrap carousel ignoring datainterval attributeStack Overflow
版权声明:本文标题:javascript - Bootstrap carousel ignoring data-interval attribute - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745179169a2646386.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论