swiper的paginationRender如何与滑动事件一起使用?请教各位大佬

//swiper的paginationRender如何与滑动事件一起使用?
<br> var swiper = new Swiper(&#39;.vip_user_order&#39;, {<br> autoHeight: true, //enable auto height<br> pagination: &#39;.order_nav&#39;,<br> paginationClickable: true,<br> paginationBulletRender: function (swiper,index, className) {<br> switch (index) {<br> case 0: name=&#39;全部&#39;;break; <br> case 1: name=&#39;待付款&#39;;break;<br> case 2: name=&#39;待发货&#39;;break;<br> case 3: name=&#39;已成交&#39;;break;<br> default: name=&#39;&#39;;<br> }<br> return &#39;<a class="' + className + '">&#39; + name + &#39;</a>&#39;;<br> }<br> });<br> /* var Myswiper = new Swiper(&#39;.swiper-container&#39;, {<br> on:{ <br> slidePrevTransitionEnd:function(){<br> alert(&quot;后退&quot;);<br> },<br> slideNextTransitionEnd:function(){<br> alert(&quot;前行&quot;);<br> },<br> }<br> }); */<br>

1个回答

已解决

    <script>
        var swiper = new Swiper('.vip_user_order', {
            onSlideChangeStart: function(swiper){
                console.log(swiper.activeIndex);
            },
            autoHeight: true, //enable auto height
            pagination: '.order_nav',
            paginationClickable: true,
            paginationBulletRender: function (swiper,index, className) {
            switch (index) {
              case 0: name='全部';break; 
              case 1: name='待付款';break;
              case 2: name='待发货';break;
              case 3: name='已成交';break;
              default: name='';
            }
                  return '<a class="' + className + '">' + name + '</a>';
              }
        });
    </script>
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐