<div id="topNav" class="swiper-container">
<div class="daohang">
<ul class="swiper-wrapper">
<li class="swiper-slide"><a href="-sharp"></a></li>
<li class="swiper-slide"><a href="-sharp"></a></li>
<li class="swiper-slide"><a href="-sharp"></a></li>
<li class="swiper-slide"><a href="forum.php?mod=forumdisplay&fid=49"></a></li>
<!--{if empty($personalnv["banitems"]["2"])}-->
<li class="swiper-slide{if $_GET[fid] == "2"} active{/if}"><a href="forum.php?mod=forumdisplay&fid=2"></a></li>
<!--{/if}-->
<li class="swiper-slide"><a href="-sharp"></a></li>
<li class="swiper-slide"><a href="-sharp"></a></li>
<li class="swiper-slide"><a href="-sharp"></a></li>
<li class="swiper-slide"><a href="-sharp"></a></li>
<li class="swiper-slide"><a href="-sharp"></a></li>
<li class="swiper-slide"><a href="-sharp"></a></li>
<li class="swiper-slide"><a href="-sharp"></a></li>
<li class="swiper-slide"><a href="-sharp"></a></li>
<!--{if empty($personalnv["banitems"]["49"])}-->
<li class="swiper-slide{if $_GET[fid] == "49"} active{/if}"><a href="/forum.php?mod=forumdisplay&fid=49"><i class="bbbbb"></i></a></li>
<!--{/if}-->
<li class="swiper-slide"><a href="-sharp"></a></li>
<li class="swiper-slide"><a href="-sharp"></a></li>
<li class="swiper-slide"><a href="-sharp"></a></li>
<li class="swiper-slide"><a href="-sharp"></a></li>
<li class="swiper-slide"><a href="-sharp"></a></li>
</ul>
</div> <div class=" gradient-r" style="opacity: 1;"></div>
<div class=" gradient-l" style="opacity: 1;"></div>
<a aria-label="" role="button" href="/m/s/sort" target="_self" class=" expand-btn "><i></i></a>
</div>
<script type="text/javascript">
var mySwiper = new Swiper("-sharptopNav .daohang", {
freeMode: true,
freeModeMomentumRatio: 0.5,
slidesPerView: "auto",
});
swiperWidth = mySwiper.container[0].clientWidth
maxTranslate = mySwiper.maxTranslate();
maxWidth = -maxTranslate + swiperWidth / 2
mySwiper.on("tap", function(swiper, e) {
slide = swiper.slides[swiper.clickedIndex]
slideLeft = slide.offsetLeft
slideWidth = slide.clientWidth
slideCenter = slideLeft + slideWidth / 2
// slide
mySwiper.setWrapperTransition(300)
if (slideCenter < swiperWidth / 2) {
mySwiper.setWrapperTranslate(0)
} else if (slideCenter > maxWidth) {
mySwiper.setWrapperTranslate(maxTranslate)
} else {
nowTlanslate = slideCenter - swiperWidth / 2
mySwiper.setWrapperTranslate(-nowTlanslate)
}
})
</script>
I am a novice. I scribbled casually. I have realized the slide. I can"t locate it after clicking. I went back to the first one before clicking. Ask the god to help ~