My Animate() callbacks execute before the animation is finis
Hi!
I'm animating a sliding panel but my callback executes right away when you click the slider link.
This is the code:
-
$(document).ready(function(){
var stat = 0;
// Event Binding
$("#top-panel a.login").click(function(){
if (!stat) {
$("#top-panel").animate({
"top": "0px"
}, { "duration": "slow", "easing": "swing"
}, $("#top-panel a.login").addClass("panel-down"))
stat = 1;
}
else {
$("#top-panel").animate({
"top": "-78px"
}, { "duration": "normal", "easing": "swing"
}, $("#top-panel a.login").removeClass("panel-down"))
stat = 0;
}
});
});
anything wrong with my animate function?
thx