$('.myElem').live('click', function() {
$(this).hide(500, function() {
$(this).siblings('.myOtherElem').show();
});
});
The above doesn't work because $(this)
is no longer in correct scope in the callback. How do I pass my original source element into the callback?
.show()
call in the callback ensures that it won't happen until the.hide()
animation is completed. The code in your answer will cause them to both happen nearly simultaneously. – Ugrian