Last active
February 9, 2016 19:37
-
-
Save hfknight/78cc2c1b354af0c75692 to your computer and use it in GitHub Desktop.
Mobile Safari CSS :hover caching issue (go back button)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* on an iOS device, when you click the link having :hover css and navigate away to the next page and then hit the browsers’ back button, when you come back on this screen, you will see the above link is still in hover state */ | |
// use Modernizr, the no-touch class will be added to the root html element for non-touch devices. Then you can do this | |
a.myclass { | |
color:#999; | |
} | |
.no-touch a.myclass:hover, | |
a.myclass:active { | |
color:#ccc; | |
} | |
// or use media query to limit the hover state only on desktop (no sense to use hover on mobile web anyway) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment