I have a script that animates an element as follows:
var item_height = $('#item').height();
$('#item').height(0);
$('#item').animate({ height: item_height });
Now suppose the animation needs to be stopped before it is complete:
$('#item').stop();
How can I get the end value of the animation? (The total height of the element when the animation would have been complete)
You can use
.stop(true,true)to clear the animation queue and automatically “jump to the end” of the animation (instead of just stopping in its line)You could also save the value you want later using
.data():