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!
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!
Share Improve this question asked Nov 5, 2010 at 15:01 AlexAlex 973 silver badges7 bronze badges1 Answer
Reset to default 17You 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");
}
});
You can test it out here.