be-fe / iSlider

Smooth mobile touch slider for Mobile WebApp, HTML5 App, Hybrid App
http://be-fe.github.io/iSlider/
MIT License
1.66k stars 448 forks source link

发现bug一枚,pause()方法有问题的 #436

Open hellozhangran opened 6 years ago

hellozhangran commented 6 years ago

如题 ~

pause只是清理了this._LSN.autoPlay上的当前计时器,如果执行pause的时候,代码已经进入了slideTo环节,其实清理_LSN.autoPlay已经没有用了。 slideTo执行到最后会自动创建新的计时器进入下一轮播放。

验证: 随便找个demo, 开启自动播放模式,因为duration默认是2000。就在初始化iSlider代码后面加上

setTimeout(()=>{
     islider.pause()
}, 2000)

你会发现是暂停不了的。 (如果不能复现的话,可以改个延迟执行时间,多试试很容易重现)