Javascript 为了将转盘集成到引导页面中,我必须做什么
这是转盘的链接。我必须在哪里介绍此代码 HTMLJavascript 为了将转盘集成到引导页面中,我必须做什么,javascript,html,twitter-bootstrap,Javascript,Html,Twitter Bootstrap,这是转盘的链接。我必须在哪里介绍此代码 HTML Bootstrap 3多张幻灯片转盘 JS $('myCarousel')。carousel({ 间隔时间:4000 }) $('.carousel.item')。每个(函数(){ var next=$(this.next(); 如果(!next.length){ next=$(this.sibbines(':first'); } next.children(':first child').clone().appendTo($(this));
Bootstrap 3多张幻灯片转盘
JS
$('myCarousel')。carousel({
间隔时间:4000
})
$('.carousel.item')。每个(函数(){
var next=$(this.next();
如果(!next.length){
next=$(this.sibbines(':first');
}
next.children(':first child').clone().appendTo($(this));
对于(var i=0;i首先,检查所有文件是否确实存在于路径所指向的位置。只是为了消除404个错误
如果这不起作用,您可以尝试使用jQuery插件
从jQuery下载页面:
我们创建了jQuery迁移插件,以简化从较旧版本的jQuery的转换。该插件可恢复不推荐的功能和行为,以便较旧的代码仍能在jQuery 1.9及更高版本上正常运行。使用未压缩的开发版本诊断兼容性问题,它将在控制台上生成警告,提示您可用于识别和修复问题。使用压缩生产版本仅修复兼容性问题,而无需生成控制台警告
也许可以把它放到你的页面上?阅读文档。我这样做了,但它不起作用(A哦,必须更改照片不起作用)然后检查控制台。你有什么错误?你在页面上包含了必要的javascript吗?我在哪里可以看到错误?问题是这是我第一次使用Bootstrap,这就是我问的原因。这就是我包含的控制台?F12
要在Chrome/Firefox/IE上打开调试工具,然后找到并打开控制台。
<div class="col-md-12 text-center"><h3>Bootstrap 3 Multiple Slide Carousel</h3></div>
<div class="carousel slide" id="myCarousel">
<div class="carousel-inner">
<div class="item active">
<div class="col-xs-2"><a href="#"><img src="http://placehold.it/500/e499e4/fff&text=1" class="img-responsive"></a></div>
</div>
<div class="item">
<div class="col-xs-2"><a href="#"><img src="http://placehold.it/500/e477e4/fff&text=2" class="img-responsive"></a></div>
</div>
<div class="item">
<div class="col-xs-2"><a href="#"><img src="http://placehold.it/500/eeeeee&text=3" class="img-responsive"></a></div>
</div>
<div class="item">
<div class="col-xs-2"><a href="#"><img src="http://placehold.it/500/f4f4f4&text=4" class="img-responsive"></a></div>
</div>
<div class="item">
<div class="col-xs-2"><a href="#"><img src="http://placehold.it/500/f566f5/333&text=5" class="img-responsive"></a></div>
</div>
<div class="item">
<div class="col-xs-2"><a href="#"><img src="http://placehold.it/500/f477f4/fff&text=6" class="img-responsive"></a></div>
</div>
<div class="item">
<div class="col-xs-2"><a href="#"><img src="http://placehold.it/500/eeeeee&text=7" class="img-responsive"></a></div>
</div>
<div class="item">
<div class="col-xs-2"><a href="#"><img src="http://placehold.it/500/fcfcfc/333&text=8" class="img-responsive"></a></div>
</div>
</div>
<a class="left carousel-control" href="#myCarousel" data-slide="prev"><i class="glyphicon glyphicon-chevron-left"></i></a>
<a class="right carousel-control" href="#myCarousel" data-slide="next"><i class="glyphicon glyphicon-chevron-right"></i></a>
</div>
$('#myCarousel').carousel({
interval: 4000
})
$('.carousel .item').each(function(){
var next = $(this).next();
if (!next.length) {
next = $(this).siblings(':first');
}
next.children(':first-child').clone().appendTo($(this));
for (var i=0;i<4;i++) {
next=next.next();
if (!next.length) {
next = $(this).siblings(':first');
}
next.children(':first-child').clone().appendTo($(this));
}
});