Jquery - fadeIn/fadeOut flicker on rollover

前端 未结 2 486
甜味超标
甜味超标 2021-01-15 14:26

I am using the following code to acheive a fadeIn/fadeOut effect on rollover/rollout of it\'s parent div.

$(\'.rollover-section\').hover(function(){  
   $         


        
相关标签:
2条回答
  • 2021-01-15 14:37

    As it was stated already it's because those modify the css and change the display to none. By using fadeTo you can get the same effect, but it doesn't modify the css, so it should work correctly.

    update example: http://jsfiddle.net/TFhzE/1/

    you can also do

    $('.rollover-section').hover(function() {  
       $('.target', this).stop().fadeTo(0,250);
     }, function() {
       $('.target', this).stop().fadeTo(250,0,function(){$(this).hide();});
    });
    

    to completely hide it yourself once it actually is complete.

    0 讨论(0)
  • 2021-01-15 14:55

    I've put my answer from the comments here:

    Just use the animate example you have there. Check here for an answer to why the fade animation behaves the way it does: jQuery fade flickers

    0 讨论(0)
提交回复
热议问题