OnMouseOver在Safari中不起作用

时间:2013-10-16 20:54:28

标签: html wordpress onmouseover

http://localboyoutfitters.com

在Chrome / Firefox / IE中正常工作,但只有第三个悬停图像在Safari中有效。

这是我的其中一张图片的代码..(我的标签按钮坏了很抱歉格式不好) (我在下面的href上有一个括号,但我的键盘限制不得不把它带走)

<a href="http://localboyoutfitters.com/wp-content/uploads/2013/10/LBO_topoffer_SMnew.png">
<img src="http://localboyoutfitters.com/wp-content/uploads/2013/10/LBO_topoffer_SMnew.png" alt="LBO_topoffer_SMnew" onmouseover="this.src='http://localboyoutfitters.com/wp-content/uploads/2013/10/LBO_topoffer_SMhover.png'" onmouseout="this.src='http://localboyoutfitters.com/wp-content/uploads/2013/10/LBO_topoffer_SMnew.png'" width="300" height="200" class="alignnone size-full wp-image-205" />
</a>

这是放在Wordpress小部件区域。

如果有人有任何解决方案,我们将不胜感激!

2 个答案:

答案 0 :(得分:-1)

最好使用mouseenter和mouseleave:

<a href="http://localboyoutfitters.com/wp-content/uploads/2013/10/LBO_topoffer_SMnew.png">
<img src="http://localboyoutfitters.com/wp-content/uploads/2013/10/LBO_topoffer_SMnew.png" alt="LBO_topoffer_SMnew" onmouseenter="this.src='http://localboyoutfitters.com/wp-content/uploads/2013/10/LBO_topoffer_SMhover.png'" onmouseleave="this.src='http://localboyoutfitters.com/wp-content/uploads/2013/10/LBO_topoffer_SMnew.png'" width="300" height="200" class="alignnone size-full wp-image-205" />
</a>

答案 1 :(得分:-1)

你可以在Jquery中轻松完成,一些javascript代码不能与其他浏览器一起使用,你可以检查jquery,你必须创建一个函数。您必须添加以下代码:

<script>
       function mouse(){
            $(document).ready(function (){
                 window.location("anywebsite");
            });
        }
</script>




<img src="http://localboyoutfitters.com/wp-content/uploads/2013/10/LBO_topoffer_SMnew.png" alt="LBO_topoffer_SMnew" onmouseenter="mouse();" width="300" height="200" class="alignnone size-full wp-image-205" />