如何使用png和jquery进行翻转?

我对我在网上找到的脚本进行反向编码并且运行良好,唯一的问题是hover图像在完全可见时加载,直到发生hover操作。 这是脚本:

$(document).ready(function() { $("img.b").hover( function() { $(this).stop().animate({"opacity": "1"}, "slow"); }, function() { $(this).stop().animate({"opacity": "0"}, "slow"); }); });  

这是CSS文件:

  div.fadehover { position: relative; } img.b { position: absolute; left: 0; top: 0; z-index: 10; } img.a { position: absolute; left: 0; top: 0; }  

这是身体代码:

  

您可以在此处查看其示例: http : //www.kaimeramedia.com/derek/Website/test.html

改变你的CSS让它隐藏onload:

 img.b { position: absolute; left: 0; top: 0; z-index: 10; opacity: 0; filter: alpha(opacity=0); } 

filter:alpha(opacity=0); 行是为IE

这是上述解决方案的一个方面: http : //jsfiddle.net/jasper/CyJXD/