I have a simple jQuery animation that moves a div to the right or left, upon a .click() event.
However, if the user clicks the event twice, it fires twice, which mes
You can use one() in jquery:
$('a#right').one("click", function () {
slide($(this));
});
function slide(obj) {
if (obj.is(':visible')) {
$('#slide').animate({right: '+=257'}, 400, function () {
slide_button();
$('a#right').one("click", function () {
slide($(this));
}
});
}
After the animation is completed, the click event is bound to the link again and it can be executed at most once.