这里我创建了一个导航,但是当您单击导航'+‘时,所有的链接都会立即显示出来,我希望它们与动画同步显示。
以下是小提琴链接:http://jsfiddle.net/6xVNz/3/
jquery代码:
$("#open").click(function(){
$(".nav, #close").show();
$(".nav li").show();
$(".nav li").each(function (i) {
$(this).delay(50*i).animate({width:150},50); // Change 300 to something else if you like
});
$("#open").hide();
});
$("#close").click(function(){
$("#close").hide();
$($(".nav li").get().reverse()).each(function (i) {
$(this).delay(50*i).animate({width:0},50); // Change 300 to something else if you like
});
$("#open").show();
});发布于 2013-11-29 07:40:52
只需像这样修改代码:
$("#open").click(function(){
$(".nav, #close").show();
$(".nav li").show();
$(".nav li").each(function (i) {
$(this).delay(50*i).animate({width:150},50); // Change 300 to something else if you like
});
$("#open").hide();
});
$("#close").click(function(){
$("#close").hide();
$($(".nav li").get().reverse()).each(function (i) {
$(this).delay(50*i).animate({width:0},50); // Change 300 to something else if you like
});
$("#open").show();
$(".nav li").hide('slow');
});发布于 2013-11-29 08:00:54
$("#open").click(function(){
$(".nav, #close").show();
$(".nav li").show();
$(".nav li").each(function (i) {
$(this).delay(50*i).animate({width:150},50); // Change 300 to something else if you like
});
$("#open").hide();
});
$("#close").click(function(){
$("#close").hide();
$($(".nav li").get().reverse()).each(function (i) {
$(this).delay(50*i).animate({width:0},50); // Change 300 to something else if you like
});
$("#open").show();
$(".nav li").hide('slow');
});发布于 2013-11-29 11:41:20
这应该能起作用:
$("#open").click(function(){
$(".nav, #close").show();
$(".nav li").each(function (i) {
$(this).delay(50*i).animate({width:150},50).show(50);
});
$("#open").hide();
});
$("#close").click(function(){
$("#close").hide();
$($(".nav li").get().reverse()).each(function (i) {
$(this).delay(50*i).animate({width:0},50).hide(50);
});
$("#open").show();
});https://stackoverflow.com/questions/20280567
复制相似问题