Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery fade not Animating Smoothly

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/

like image 799
user1119648 Avatar asked Jun 10 '13 01:06

user1119648


People also ask

Which property will allow smooth fade in fadeOut animation?

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.

How to set fadeOut time in jQuery?

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.

How to stop fadeOut jQuery?

stop(). animate({opacity:'100'}) combo is what allows any fadIn/fadeOut to restart based on your trigger. Works great.

How does jQuery fadeOut work?

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.


1 Answers

Take this out of the elements you want to fade, and it works fine. example: jsfiddle

transition:.5s ease-in-out;
like image 59
James Avatar answered Sep 22 '22 10:09

James