我正在尝试使用idangero swiper和jquery标签我得到了我想要的所有结果,除了pagination.slider分页只显示一个项目符号。使用单个标签时工作正常,但我不知道如何申请swiper当需要两个或多个标签时。我的代码和jsfiddle链接例如。http://jsfiddle.net/Rzeiwald/wunw9enL/3/ - http://jsfiddle.net/Rzeiwald/m61qfck1/ 感谢您的时间 HTML
<div class="panel" style="background : transparent; border: none;">
<div id="tabs-centre" style="background : transparent;margin-left:5px;border: none;">
<ul>
<li><a href="#tabs-centre-1">op</a></li>
<li><a href="#tabs-centre-2">oop</a></li>
</ul>
<div id="tabs-centre-1">
<!-- Swiper -->
<div class="swiper-container">
<div class="swiper-wrapper">
<div class="swiper-slide roundbox">
</div>
<div class="swiper-slide roundbox">
</div>
<div class="swiper-slide roundbox">
</div>
<div class="swiper-slide roundbox">
</div>
<div class="swiper-slide roundbox">
</div>
</div>
<!-- Add Pagination -->
<div class="swiper-pagination" ></div>
<!-- Add Arrows -->
<div class="swiper-button-next"></div>
<div class="swiper-button-prev"></div>
</div><!--Swiper Ends-->
</div><!-- End: Tabs1 -->
<div id="tabs-centre-2">
<!-- Swiper -->
<div class="swiper-container">
<div class="swiper-wrapper">
<div class="swiper-slide roundbox">
</div>
</div>
<!-- Add Pagination -->
<div class="swiper-pagination" ></div>
<!-- Add Arrows -->
<div class="swiper-button-next"></div>
<div class="swiper-button-prev"></div>
</div><!--Swiper Ends-->
</div><!-- End: Tabs2 -->
</div>
</div>
的Javascript
var swiper = new Swiper('.swiper-container', {
pagination: '.swiper-pagination',
nextButton: '.swiper-button-next',
prevButton: '.swiper-button-prev',
slidesPerView: 3,
centeredSlides: false,
paginationClickable: true,
autoplay: 2500,
spaceBetween: 15,
});
答案 0 :(得分:0)
1-根据swiper initialization,您必须在$(document).ready
或body
的结尾或window.onload
内调用您的脚本。
2-你必须在swiper之后拨打.tabs()
。我认为swiper试图应用隐藏或没有宽度/高度等的元素。
$(document).ready(
function () {
var swiper = new Swiper('.swiper-container', {
pagination: '.swiper-pagination',
nextButton: '.swiper-button-next',
prevButton: '.swiper-button-prev',
slidesPerView: 3,
centeredSlides: false,
paginationClickable: true,
autoplay: 2500,
spaceBetween: 15,
});
$('#tabs').tabs();
});