I am working with two buttons in a Javascript carousel and need to prevent users from double-clicking on the buttons. Below is the code I am using:
var onRightArrow = function(e) {
if (unitCtr<=unitTotal) {
unitCtr++;
TweenLite.to(productTxt, 0.2, {y: "-="+unitHeight });
TweenLite.to(productImg, 0.2, {y: "-="+unitHeight });
}
hideArrows();
}, onLeftArrow = function(e) {
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);
I want to disable the ability for users to double click on these buttons as it affects the positioning of elements in the carousel. Any suggestions on how to achieve this without using JQuery would be appreciated.
For more code examples, you can visit this link.