Reputation: 97
Does anyone know a good way to fire a callback function on the slideUp event only during a slideToggle? The default callback function fires on both slideUp and slideDown.
Thanks!
Upvotes: 5
Views: 5657
Reputation: 630429
You can check if the element .is()
:hidden
since it'll be hidden at the end of a slide up, like this:
$(this).slideToggle(function() {
if($(this).is(":hidden")) {
alert("this was a slide up");
}
});
Upvotes: 17