Some devices (as others have said) have both touch and mouse events. For example, the Microsoft Surface has a touch screen, trackpad, and stylus that actually raises hover events when it hangs over the screen.
Any solution that disables :hover based on the presence of touch events also affects Surface users (and many other similar devices). Many new laptops are touching each other and will respond to touch events - so disabling freezing is really bad practice.
This is a bug in Safari, absolutely no excuse for this terrible behavior. I refuse to sabotage non-iOS browsers due to a bug in iOS Safari that has obviously been there for years. I really hope they fix it for iOS8 next week, but in the meantime ....
My decision:
Some have suggested using Modernizr already; well, Modernizr allows you to create your own tests. What I mostly do here is abstracting the idea of a browser that supports :hover in the Modernizr test, which I can use in all my code without hard coding if (iOS) .
Modernizr.addTest('workinghover', function () {
Then css becomes something like this
html.workinghover .rollover:hover {
Only on iOS will this test fail and disable rollover.
The best part of such an abstraction is that if I find that it breaks on a specific android or if it is fixed in iOS9, then I can just change the test.
Simon_Weaver Sep 14 '14 at 19:45 2014-09-14 19:45
source share