Opera 和 SlideToggle() 的 jQuery 奇怪问题
我在使用 jQuery 和 Opera 时遇到了一个奇怪的问题。当我使用slideToggle()时,它在Firefox、Chorme、Safari甚至IE中运行良好且流畅,但在Opera中则不然。在歌剧中,动作有点破碎:首先移动一点,然后停止,最后直接跳到结束。
这是我的代码:
$("#new").hover(function(){ $(".intro").slideToggle(300) })
和链接:
某物的名称 某事的介绍
最奇怪的问题是:当我添加另一个链接(与另一个链接相同,期望其他 id)时,Opera 加载两个介绍跨度都很好。但只有一个介绍跨度,它并不顺利。
该代码现在也位于 jsFiddle 上(http://jsfiddle.net/3YstS/6)。
I have a weird problem with jQuery and Opera. When I am using slideToggle(), it runs fine and smooth in Firefox, Chorme, Safari and even in IE, but not in Opera. In Opera the motion is kind of broken: first it moves a little, then it stops and finally it jumps straight to end.
Here is my code:
$("#new").hover(function(){
$(".intro").slideToggle(300)
})
And the link:
The name of something
The introduction of something
The oddest problem is there: when I add another link (same than the other, expect other id), then Opera loads both intro-spans fine. But with only one intro-span, it isn't smooth.
The code is now on jsFiddle too (http://jsfiddle.net/3YstS/6).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
所示
正如我之前的小提琴http://jsfiddle.net/3YstS/9/
http://jsfiddle.net/3YstS/10/
我发现其中存在一些严重的不一致Opera 处理这个问题的方式,现在我认为这是 Opera 的一个错误。
不过已经找到解决办法了
http://jsfiddle.net/3YstS/13/
实际上是 CSS Float 导致了问题。当你移除浮子时,问题就消失了。
问题已解决。
如果您需要将 .name div 向右对齐,则必须将其包装在应用了position:relative的div中,然后然后应用位置:绝对和 right:0 到 .name div。
像这样的东西
希望这对你们大家有一些帮助,甚至可能对 Opera 本身有帮助。
As demonstrated in my previous fiddles
http://jsfiddle.net/3YstS/9/ &
http://jsfiddle.net/3YstS/10/
I found that there is some serious inconsistency in the way Opera handles this, for now I'll consider this to be a bug with opera.
However have found a solution
http://jsfiddle.net/3YstS/13/
It is actually the CSS Float which causes an issue. When you remove the float the problem goes away.
Problem Solved.
If you need to align the .name div to the right you must wrap it in a div with position:relative applied, and then apply position:absolute and right:0 to the .name div.
Something like this
Hope this is of some help to you all ,and maybe even Opera themselves.
评论中Blowsie的测试表明确实存在bug。奇怪的行为。您是否在 Opera bug 向导上报告了该问题?
在这里发布好的代码,以便人们在 jsfiddle 消失时有一个参考。
JAVASCRIPT
HTML 代码
CSS 代码
The tests of Blowsie in the comments show indeed that there is a bug. Strange behavior. Did you report it on Opera bug wizard.
Posting here the good code so people have a reference in case jsfiddle disappears.
JAVASCRIPT
HTML code
CSS Code