Jquery延迟不起作用
大家好,我正在尝试做一个简单的动画,有一些延迟,但它不工作,请给我一只手。这是密码Jquery延迟不起作用,jquery,delay,Jquery,Delay,大家好,我正在尝试做一个简单的动画,有一些延迟,但它不工作,请给我一只手。这是密码 $(document).ready(function() { $('.detailsholder').hide() $(".detailsholder").animate({"top": '-520px'},1) $('.detailsholder').hide() $('.detailsholder').fadeIn(500) $('.detailsholder').de
$(document).ready(function() {
$('.detailsholder').hide()
$(".detailsholder").animate({"top": '-520px'},1)
$('.detailsholder').hide()
$('.detailsholder').fadeIn(500)
$('.detailsholder').delay(5000).animate({'top': "-260px",'easing': "easeInElastic"}, 400).delay(5000).('.detailsholder').animate({'top': "0px",'easing': "easeInElastic"},400);
});
我假设您希望每个
delay()。现在,延迟将在动画发生时运行
此外,正如评论所说,您应该真正链接您的语句,并在行尾添加分号。代码的第6行有错误(为了更好地阅读,我将该行拆分为几行:
$('.detailsholder')
.delay(5000)
.animate({'top': "-260px",'easing': "easeInElastic"}, 400)
.delay(5000)
.('.detailsholder') // The method is missing here!
.animate({'top': "0px",'easing': "easeInElastic"},400);
注意:您还应该链接jQuery代码,并在每个命令后加上分号。您还可以对事件进行排队,因为延迟仅适用于动画队列
我创造了这个小提琴:
你也可以看看另一个帖子:。这里有一个给你
$('.detailsholder')
.hide()
.css('top', '200px')
.fadeIn(500)
.delay(2000)
.animate({'top': "100px", 'easing': "easeInElastic"}, 400)
.delay(2000)
.animate({'top': "0px", 'easing': "easeInElastic"}, 400);
你可以考虑使用ID而不是类,因为你的动画看起来很独特。
享受!:)分号都在哪里?您应该链接jQuery语句:(.这是jQuery对JavaScript知识产生不良影响的一个例子。你们是要帮我让这件事正常运行,还是要问一些愚蠢的问题?我显然不像你们那样理解jQuery。我需要你们的帮助!看看这个答案“这里缺少方法!”?这不起作用,因为它是您的代码?请看注释,您忘记了该行中的方法。
$('.detailsholder')
.hide()
.css('top', '200px')
.fadeIn(500)
.delay(2000)
.animate({'top': "100px", 'easing': "easeInElastic"}, 400)
.delay(2000)
.animate({'top': "0px", 'easing': "easeInElastic"}, 400);