jquery setTimeOut问题
我想将窗口滚动到顶部,暂停动画 1 秒,然后使用 fadeOut 擦除内容,但此代码不起作用,你知道为什么吗?
$('#link').bind('click', function(){
preloading.show();
$('html,body').animate({'scrollTop':0}, 300, function(){
$('#myDiv').setTimeout(function(){
$(this).empty()
.append(conteneurBio).hide()
.fadeIn('slow', function(){
preloading.hide();
});
}, 1000);
});
i would like to scroll the window to the top, pause my animation for 1 second, and then use a fadeOut to erase the content, but this code doesn't work, do you know why?
$('#link').bind('click', function(){
preloading.show();
$('html,body').animate({'scrollTop':0}, 300, function(){
$('#myDiv').setTimeout(function(){
$(this).empty()
.append(conteneurBio).hide()
.fadeIn('slow', function(){
preloading.hide();
});
}, 1000);
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这不也行吗?
Wouldn't this work too?
您缺少一组结束
});
:You're missing one set of closing
});
s:使用类似的东西: http://jsbeautifier.org/
它可以帮助您找到 JavaScript 中丢失的方括号/大括号,尤其是当您没有可以为您进行缩进的编辑器时。
约瑟夫在我面前发布了正确的答案,但你缺少一个“});”在最后
used something like: http://jsbeautifier.org/
it helps you find any missing brackets/braces in your javascript, especially when you don't have an editor that does the indentation for you.
Joseph posted before me with the correct answer though, you're missing a "});" at the end