Overriding Hover Styles on Mobile

I’m always looking for more snippets of code, markup, etc. to add to my always growing TextExpander list of bits I’ll reuse. This is a definite one I immediately added.

Often, hover effects on mobile translate to users having to click twice to get to the targeted URL/event. This little bit of jQuery helps eliminate that:

$(‘a’).on(‘click touchend’, function(e) {
var el = $(this);
var link = el.attr(‘href’);
window.location = link;

Source: Learning jQuery – Using jQuery .click() Events to Override Hover Styles on Mobile

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.