I have some css menus on my site that expand with :hover
(without js)
This works in a semi-broken way on iDevices, for example a tap will activate the :hover
rule and expand the menu, but then tapping elsewhere doesn't remove the :hover
. Also if there is a link inside the element that is :hover
'ed, you have to tap twice to activate the link (first tap triggers :hover
, second tap triggers link).
I've been able to make things work nicely on iphone by binding the touchstart
event.
The problem is that sometimes mobile safari still chooses to trigger the :hover
rule from the css instead of my touchstart
events!
I know this is the problem because when I disable all the :hover
rules manually in the css, mobile safari works great (but regular browsers obviously don't anymore).
Is there a way to dynamically "cancel" :hover
rules for certain elements when the user is on mobile safari?
I'm using jQuery.