I use jquery.hover to toggle a class when someone mouses over a link. On the iphone when someone taps the link, it toggles the class on, but it doesn't ever toggle the class off until they开发者_如何学编程 tap somewhere else.
From the event section of the Mobile Safari Guide
If the user taps a nonclickable element, no events are generated. If the user taps a clickable element, events arrive in this order: mouseover, mousemove, mousedown, mouseup, and click. The mouseout event occurs only if the user taps on another clickable item
There are a variety of touch events you can use on mobile Safari rather than mouse events. For example you can use the touchStart
and touchEnd
events to determine when the user has put their finger down/taken it off on an element
My suggestion with iPhone web apps is to not use the mouseover events... If there isn't a mouse (which there isn't), it doesn't make for the best user experience. Can you key it off of a different action?
I use use a 'close button' for large rollover nav divs when viewed in iphone. Easily overlooked solution for a lot of rollout situations.
精彩评论