Skip to content

Instantly share code, notes, and snippets.

@gtempesta
Last active April 11, 2019 15:15
Show Gist options
  • Save gtempesta/f5ba14f4ca6613e73cfbbc56e6f413f6 to your computer and use it in GitHub Desktop.
Save gtempesta/f5ba14f4ca6613e73cfbbc56e6f413f6 to your computer and use it in GitHub Desktop.
hover state in iOS
// If you need to have a different appearance on hover in iOS
// you have to simulate it by toggling a class on touchstart/touchend
// and then style the element accordingly
// source: https://stackoverflow.com/a/2891155/
$('.hovered-element').on('touchstart touchend', function () {
$(this).toggleClass('touch-hover');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment