开发者

Transition From Black and White to Color?

开发者 https://www.devze.com 2023-01-24 06:22 出处:网络
I have an icon that\'s in black and white, and I want the icon to transition to the color icon (as a crossfade) during the hover event. How can I do thi开发者_开发百科s in jQuery? #stumped.

I have an icon that's in black and white, and I want the icon to transition to the color icon (as a crossfade) during the hover event. How can I do thi开发者_开发百科s in jQuery? #stumped.

Thanks!


An example is here : Greyscale Hover Effect w/ CSS & jQuery


How about fading one in and the other out?

$(function(){
  $('#coloricon').hide();

  $("#bwicon").hover(function(){ 
    $('#bwicon').fadeOut('slow');
    $('#coloricon').fadeIn('slow');
  });
});

<img id="bwicon" src="bw.png" style="position:absolute;top:50;left:50;">
<img id="coloricon" src="color.png" style="position:absolute;top:50;left:50;">
0

精彩评论

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