Last Updated: February 25, 2016
·
281
· adamphillips

Enable :active state on iOS

The :active pseudo-selector doesn't work by default on iOS. Fortunately there is a simple fix - simply bind an eventHandler to the touchstart event on any elements that need to use the :active state.

$(window).on('load', function() {
  if(/iP(hone|ad)/.test(window.navigator.userAgent)) {
    $('.things-that-need-active').on('touchstart', function() {});
  }
});

More details over at http://blog.29ways.co.uk/tips-for-consistent-mobile-behaviour/