var timer; $("#ar2").click(function () { clearTimeout(timer); timer = setTimeout(function () { $("#wrapper div").animate({ "marginLeft" : "-=410px" }, 400); }, 100); });