我有 OWL CAROUSEL 的下一个问题。我正在使用单个项目选项和悬停时停止自动播放选项。在每个项目内部,我都使用引导按钮来打开模式。模态在 OWL CAROUSEL 之外。一切正常,直到我们到达旋转木马的最后一项。当我按下按钮时,模式打开,如果幻灯片发生变化(因为自动播放)并且我关闭模式,它就会爆发。我还删除了悬停时的停止,在我打开最后一个项目模式后,轮播卡住了。
猫头鹰旋转木马
<div id="owl-demo" class="owl-carousel">
<div class="item">
<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">MODAL</button>
<img src="http://www.highsnobiety.com/files/2013/05/lamborghini-egoista-concept-car-9.jpg" alt="The Last of us">
</div>
<div class="item">
<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">MODAL</button>
<img src="http://www.highsnobiety.com/files/2013/05/lamborghini-egoista-concept-car-9.jpg" alt="The Last of us">
</div>
</div>
引导标准模式
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria- labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
<h4 class="modal-title" id="myModalLabel">Modal title</h4>
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">Save changes</button>
</div>
</div>
</div>
CSS
#owl-demo .item img{
display: block;
width: 100%;
height: 300px;
}
#owl-demo .item button {
position: absolute;
}
查询
$(document).ready(function() {
$("#owl-demo").owlCarousel({
navigation : false,
autoPlay: 2200,
slideSpeed : 300,
paginationSpeed : 800,
singleItem : true,
pagination: true,
stopOnHover: true,
});
});