我的网站上有一个 javascript 下拉菜单,但它不能在 iphone/ipad 上运行,有谁知道我应该修改代码以使其在这些设备上运行?(例如黑莓菜单工作正常)。
JS文件:
var timeout = 500;
var closetimer = 0;
var ddmenuitem = 0;
// open hidden layer
function mopen(id)
{
// cancel close timer
mcancelclosetime();
// close old layer
if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
// get new layer and show it
ddmenuitem = document.getElementById(id);
ddmenuitem.style.visibility = 'visible';
}
// close showed layer
function mclose()
{
if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
}
// go close timer
function mclosetime()
{
closetimer = window.setTimeout(mclose, timeout);
}
// cancel close timer
function mcancelclosetime()
{
if(closetimer)
{
window.clearTimeout(closetimer);
closetimer = null;
}
}
// close layer when click-out
document.onclick = mclose;
下拉列表的 HTML:
<ul id="rentals">
<li><a href="#"
onmouseover="mopen('m1')"
onmouseout="mclosetime()">Verhuur</a>
<div id="m1"
onmouseover="mcancelclosetime()"
onmouseout="mclosetime()">
<a href="shortterm2bed1.html">2 Slk. Vakantie <font color="172983"> | </font></a>
<a href="shortterm3bed1.html">3 Slk. Vakantie <font color="172983"> | </font></a>
<a href="longtermrentals1.html"> Lange Termijn</a>
</div>
</li>
</ul>
任何帮助是极大的赞赏。