Home › Forums › JavaScript › .setTimout and .delay › Re: .setTimout and .delay
December 7, 2012 at 3:53 pm
#116684
Participant
I can’t seem to find out how to delay the removeClass until the menu is fully collapsed. Currently, the class is removed and the box shadow is gone before it begins to retract, and I’d like to add a delay to prevent that.
Im sorry, call me ignorant but after i read this i didnt read any more.. Sounds to me like all you need is a callback function.
$('#slider span').toggle(
function() {
$('#headerNav').animate({
left: 0
}, 'slow').addClass('active');
}, function() {
$('#headerNav').animate({
left: '-90%'
}, 'slow', function() {
$(this).removeClass('active');
});
}
);
Is this what you want?