我在 suffusion-subscription.php 中添加了自定义代码,以在鼠标悬停在图像上时更改 Facebook 图标的图像。
在初始加载期间,没有图像显示。之后 mouseHover 和 mouseOut 事件会显示适当的图像,但不会在初始加载时显示。
下图显示了该问题:
JavaScript:
//preload images:
fb1 = new Image(64,64);
fb1.src = "http://sohamshah.com/wordpress/wp-content/themes/suffusion/images/follow/Facebook-04.png";
fb2 = new Image(64,64);
fb2.src = "http://sohamshah.com/wordpress/wp-content/uploads/2011/11/fb-broken.png";
//image swapping function:
function hiLite(imgDocID, imgObjName, comment) {
document.images[imgDocID].src = eval(imgObjName + ".src");
window.status = comment; return true;
}
</script>
HTML:
<div class='fix'>
<a href="http://feeds.feedburner.com/sohamshah" class="follow-icon-and-tag" title="RSS">
<img src="http://sohamshah.com/wordpress/wp-content/themes/suffusion/images/follow/RSS-13.png" alt="RSS" style='width: 64px; height: 64px;' />
</a>
<a href="http://www.facebook.com/soham100" onMouseOver="hiLite('fb','fb2','Follow Me on FaceBook')" onMouseOut="hiLite('fb','fb1','')" class="follow-icon-and-tag" title="Facebook">
<img name="fb" "src="http://sohamshah.com/wordpress/wp-content/themes/suffusion/images/follow/Facebook-04.png" alt="Facebook" style='width: 64px; height: 64px;' />
</a>
<a href="http://twitter.com/sohamshah" class="follow-icon-and-tag" title="Twitter">
<img src="http://sohamshah.com/wordpress/wp-content/themes/suffusion/images/follow/Twitter-08.png" alt="RSS" style='width: 64px; height: 64px;' />
</a>
</div>
对此问题的任何帮助将不胜感激。
索汉姆