帮助解决此 JQuery 淡出和 in 语句
我编写了这段代码,用于在单击链接时淡出一个元素并淡入一个新元素。它正在工作,但有点抽搐,有时它会在更改和位置移动之前闪烁...自己尝试一下,然后在链接之间来回单击...哦,我在 Firefox 中看到这些故障...
有看看这里。 http://jsfiddle.net/XHXpt/2/
I have this snippet of code I wrote for fading an element out and a new element in when a link is clicked. It is working but it is kind of twitchy and sometimes it flashes before the change and the position moves...Try it for yourself and click back and forth between the links...Oh I am seeing these glitches in firefox...
Have a look here. http://jsfiddle.net/XHXpt/2/
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
它出现故障,因为已经隐藏的
元素立即完成其动画并调用您指定的
complete
回调。您可以通过仅淡入:visible
来防止这种情况,因此那些已经隐藏的不做任何事情,通过更改此:对此:
您可以测试更新的版本在这里。
It's glitching because the already hidden
<p>
elements finish their animations immediately and call thecomplete
callback you specified. You can prevent this by fading only the:visible
one, so those already-hidden ones don't do anything, by changing this:To this:
You can test out the updated version here.
添加:可见,如下所示: http://jsfiddle.net/XHXpt/5/
Add :visible as here : http://jsfiddle.net/XHXpt/5/