2
我有两个按钮,它们使用Javascript来调用它们的控制旋转木马和其他一些动作的函数。Javascript按钮,防止鼠标双击
我只想禁用用户双击按钮的能力。
这里是我的代码:
var onRightArrow = function(e) {
//alert("Right");
if (unitCtr<=unitTotal) {
unitCtr++;
TweenLite.to(productTxt, 0.2, {y: "-="+unitHeight });
TweenLite.to(productImg, 0.2, {y: "-="+unitHeight });
}
hideArrows();
}, onLeftArrow = function(e) {
//alert("Left");
if (unitCtr>1) {
unitCtr--;
TweenLite.to(productTxt, 0.2, {y: "+="+unitHeight });
TweenLite.to(productImg, 0.2, {y: "+="+unitHeight });
}
hideArrows();
}
arrowRight.addEventListener('click', onRightArrow, false);
arrowLeft.addEventListener('click', onLeftArrow, false);
我知道的代码DBLCLICK行,但不完全知道如何应用到禁止从鼠标的双击动作。
当用户现在doubleclicks,它misplaces在这就是为什么我要删除的DBLCLICK的影响按钮的功能转盘元素的定位。
在此先感谢您的任何建议。请避免在JQuery中提供答案。
更多代码: http://codepen.io/anon/pen/QjGydw
只覆盖双击事件并使其无效? – Steve
@Steve或'返回false'。 – divy3993
@ divy3993我认为返回false只适用于jQuery,纠正我,如果我错了 – Steve