简体   繁体   English

Javascript悬停效果在iPad上不起作用

[英]Javascript hover effect doesn't work on iPad

I want to create a homepage with three images swapping when hover on the menu bar. 我想创建一个主页,将鼠标悬停在菜单栏上时会交换三个图像。 The following mouseover scripts works on PC but not on iPad. 以下鼠标悬停脚本在PC上有效,但在iPad上无效。 How could I fix this problem? 我该如何解决这个问题?

<a style="text-decoration:none" href onmouseover="myFunction()">
    <h2>Investments by strategy</h2>
</a>


<a style="text-decoration:none" href onmouseover="myFunction2()">
      <h2>Investments by geography</h2>
</a>      

      <a style="text-decoration:none" href onmouseover="myFunction3()">   
    <h2>Investments by type</h2>
</a>      





<script>
function myFunction() {
    document.getElementById("myImg").src = "images/img002.png";
}

function myFunction2() {
    document.getElementById("myImg").src = "images/pie2.png";
}


function myFunction3() {
    document.getElementById("myImg").src = "images/test.png";
}


</script>  

iPad (or any other touch screen device) does NOT support mouse over effects. iPad(或任何其他触摸屏设备)不支持鼠标悬停效果。 In short, you can't "fix" this problem. 简而言之,您无法“解决”此问题。

(well, your device can't detect where your finger is hovering over the screen, right?) (嗯,您的设备无法检测到手指悬停在屏幕上方的位置,对吗?)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM