开发者

How can I show/hide a div with a background image without it fading in?

开发者 https://www.devze.com 2023-04-04 06:51 出处:网络
Currently I have images that, on mouseover, shows an img over another, but it fades in. I simply want it to show with no fade.

Currently I have images that, on mouseover, shows an img over another, but it fades in. I simply want it to show with no fade.

script:

<script type="text/javascript">
    $(document).ready(function(){
    $('.fade').hover(function() { 
      开发者_StackOverflow  $(this).stop().animate({"opacity": 1}); 
    },function() { 
        $(this).stop().animate({"opacity": 0}); 
    })
    });
</script>


you could try $(this).find('.caption').show() instead of $('.caption', this).show();


Set animation duration to 0 like this:

$(this).stop().animate({ "opacity" : 1 }, 0);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号