jQuery .bind'mouseup mouseleave touchend'有时不触发

问题描述

* 编辑-其中有两个,两个间隔都名为“ moduleController.moduletoolbarScrollInterval”,这可能是个问题吗?

** 编辑编辑-我已经在日志中看到过几次-“ 由于取消正在进行的尝试取消带有cancelable = false的touchstart事件,例如,因为正在进行滚动并且不能被打断。

情况我有一个带有两个箭头按钮的滚动条。单击其中之一时,它仅移动滚动条。单击并按住它时,会创建一个循环以继续滚动条,并在释放时清除该循环。

问题:有时候(很少),“鼠标mouseleave触摸端”不会触发,这会使滚动条处于永无止境的循环中。

$('.module-scroll-btn.right').on('click touchstart',moduleController.scrollToolbarRight);

$(".module-scroll-btn.right").on('mousedown touchstart',function (e) {
        e.preventDefault();
        e.stopPropagation();
        moduleController.moduletoolbarScrollInterval = setInterval(function () {
            moduleController.scrollToolbarRight();
        },425);
    }).bind('mouseup mouseleave touchend',function () {
        clearInterval(moduleController.moduletoolbarScrollInterval);
    });

我的想法是.bind可能有问题?有一个更好的方法吗?我在这里错过了一个问题吗?

再次,这种情况很少发生,并且复制此错误需要一段时间。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)