I have the following code in jQuery, that animates a div marginTop.
How do I set it so that once the margin top is equal 900px, disable the click event?
$("#tmbUp").click(function(){
$("#tmbHolder").animate({"marginTop": "-=100px"}, "slow");
});
$("#tmbDown").click(function(){
$("#tmbHolder").animate({"marginTop": "+=100px"}, "slow");
});
Before you call the
animatefunction, simply check the current value of the top margin. If it’s 900 (or less), don’t animate.