jQuery 动画延迟

2024-05-16

如何使用 jQuery 延迟动画?

我需要获得一个导航来扩大宽度,然后扩大高度,然后反转以获得反向动画。

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});
    });
});

使用 jQuery.delay(N)方法,其中 N 是延迟的毫秒数。

jsFiddle 示例 http://jsfiddle.net/MadaraUchiha/YVk6Z/1

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

jQuery 动画延迟 的相关文章

随机推荐