Swiper navigation bar how to achieve the positioning center after clicking?

 
 <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 ~

Jun.09,2021

you don't know what to do with that description.
free mode / do not fit edges (150) this example looks more like it.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e59ea9-4557f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e59ea9-4557f.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?