Kyle
Kyle

Reputation: 22035

jquery.hover on iphone

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.

Upvotes: 2

Views: 2592

Answers (3)

SideDishStudio
SideDishStudio

Reputation: 705

I use use a 'close button' for large rollover nav divs when viewed in iphone. Easily overlooked solution for a lot of rollout situations.

Upvotes: 0

jimr
jimr

Reputation: 11230

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

Upvotes: 4

Thom Mahoney
Thom Mahoney

Reputation: 481

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?

Upvotes: 1

Related Questions