开发者

Is it possible to trigger onmouseover event on iPhone

On iPhone 3G, is i开发者_如何学Got possible to fire onmouseover event on safari


Yes and no, the behavior is not the same as on a computer, see this list for what triggers mouseover on the iphone.


This works in WebKit. If iPhone Safari supports the event internally, this may work.

// Assuming the element you want to simulate a mouseover event with is "theElement"
var mouseoverEvent = document.createEvent('MouseEvents');
mouseoverEvent.initMouseEvent('mouseover');
theElement.dispatchEvent(mouseoverEvent);


Unfortunately that is one of the events the iPhone does not support :(

Sources: http://www.evotech.net/blog/2007/07/web-development-for-the-iphone/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜