var slideContainer = ('#slider');
var width = 720;
function slide () {
if ( parseInt( $slideContainer.css('marginLeft') ) >= -2160 ) {
$slideContainer.animate({'margin-left': '-='+width},200);
}
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<a class='button' onclick='slide()'></a>
I have this simple function, the problem is when I click multiple clicks on the button with animation speed more than 150 it take the slider container more to the left more than -2160 the limit in my if condition .
.one()like$('.button').one(function(){})