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?
$(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/
Method 1: Using CSS animation property: A CSS animation is defined with 2 keyframes. One with the opacity set to 0, the other with the opacity set to 1. When the animation type is set to ease, the animation smoothly fades in the page. This property is applied to the body tag.
The jQuery fadeOut() method is used to fade out a visible element. Syntax: $(selector).fadeOut(speed,callback); The optional speed parameter specifies the duration of the effect.
stop(). animate({opacity:'100'}) combo is what allows any fadIn/fadeOut to restart based on your trigger. Works great.
fadeOut() method animates the opacity of the matched elements. Once the opacity reaches 0, the display style property is set to none , so the element no longer affects the layout of the page. Durations are given in milliseconds; higher values indicate slower animations, not faster ones.
Take this out of the elements you want to fade, and it works fine. example: jsfiddle
transition:.5s ease-in-out;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With