Saturday, May 25, 2024
 Popular · Latest · Hot · Upcoming
45
rated 0 times [  47] [ 2]  / answers: 1 / hits: 19181  / 13 Years ago, mon, august 8, 2011, 12:00:00

How do I delay animation with jQuery?



I need to get a navigation to expand the width, and then expand the height, and then reversed for the reverse animation.



Code:



$(function() {
$(#nav li).not(#logo, #nav li ul li).hover(function(){
$(this).animate({width:200px},{queue:false,duration:1000});
}, function(){
$(this).animate({width:30px},{queue:false,duration:1000});
});


$(#nav li.parent).hover(function(){
$(this).children(ul).animate({height:40px},{queue:false,duration:500});
}, function(){
$(this).children(ul).animate({height:0px},{queue:false,duration:500});
});
});

More From » jquery

 Answers
17

use the jQuery .delay(N) methods, where N is the milliseconds to delay.



jsFiddle example


[#90736] Sunday, August 7, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
elliem

Total Points: 415
Total Questions: 117
Total Answers: 94

Location: American Samoa
Member since Fri, Aug 26, 2022
2 Years ago
;