淘宝式轮播图切换太快BUG

在项目中遇到一个问题,当手动或定时切换淘宝式轮播图时,如果速度过快,会出现跳转BUG。问题出现在点击右侧切换按钮或设定切换时间过短的情况下。目前尚未找到解决方案,寻求技术大牛的帮助。
摘要由CSDN通过智能技术生成

项目场景:

淘宝式轮播图

问题描述:

手动切换太快,或者设置定时间时间太短,切换都会出现的跳转BUG,

在这里插入图片描述

BUG源码:

JS:

   class swiper {
   
            constructor() {
   
                this.ullis = this.$('ul li', true);
                this.ul = this.$('ul');
                this.ol = this.$('ol');
                this.screen = this.$('#screen');
                this.createIndex();
                this.box = this.$('#box');
                this.imgW = this.ullis[0].offsetWidth;
                this.index = 0;
                this.times;
                this.timess;
                this.box.addEventListener('mouseover', this.overFn.bind(this));
                this.box.addEventListener('mouseout', this.outFn.bind(this));
                // 给左右按钮设置点击
                this.$('#left').addEventListener('click', this.leftClick.bind(this));
                this.$('#right').addEventListener('click', this.rightClick.bind(this));
                this.autoplay();
            }
            // 添加序列号
            createIndex() {
   
                let length = this.ullis.length;
                for (var i = 0; i < length; i++) {
   
                    let li = document.createElement('li');
                    li.innerHTML = i + 1;
                    i == 0 && (li.className = 'current');
                    this.ol.appendChild(li);
                    li.addEventListener('click', this.olliclick.bind(this));
                }
                this.olli = this.$('ol li'
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

贪吃ღ大魔王

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值