javascript jQuery 淡入淡出动画不流畅
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/17015723/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
jQuery fade not Animating Smoothly
提问by user1119648
I'm using jQuery fade on .hover to hide an element, and make it reappear on mouseexit, but when I run the .fadeOut() method, regardless of the duration I enter, or if I leave it to the default, it waits the duration then (dis)appears instantly rather than slowly fading out/in over the duration. I'm on the latest version of chrome. Anyone else run into this?
我在 .hover 上使用 jQuery 淡入淡出来隐藏一个元素,并让它重新出现在 mouseexit 上,但是当我运行 .fadeOut() 方法时,无论我输入的持续时间如何,或者如果我将其保留为默认值,它都会等待持续时间然后 (dis) 立即出现,而不是在持续时间内慢慢淡出/淡入。我使用的是最新版本的 chrome。还有人遇到这个吗?
$(document).ready(function(){
$(".navbutton").hover(
function() {
$('span.linktext, span.linkdropcap').fadeOut();
},
function() {
$('span.linktext, span.linkdropcap').fadeIn();
}
);
});
Other browsers are giving me the exact same behavior.
其他浏览器给了我完全相同的行为。
See this jsFiddle: http://jsfiddle.net/TXrDk/
看到这个jsFiddle:http: //jsfiddle.net/TXrDk/