Takazudo
3/7/2013 - 10:55 AM

Modernizr.believablehover.js

var win8orhigher = (function() {
  // windows browsers has str like "Windows NT 6.2" in its UA
  // Win8 UAs' version is "6.2"
  // browsers above this version may has touch events.
  var ua = navigator.userAgent;
  var matched = ua.match(/Windows NT ([\d\.]+)/);
  if(!matched) { return false; }
  var version = matched[1] * 1;
  if(version < 6.2) { return false; }
  return true;
}());

Modernizr.believablehover = (function() {
  if(win8orhigher) { return true; } // everything seems to be ok for Win8, maybe.
  if(Modernizr.touch) { return false; } // every other touch devices does not need hover.
  return true; // ah yes, I am a normal browser.
}());

var cls = Modernizr.believablehover ? 'believablehover' : 'no-believablehover';
$('html').addClass(cls);
<style>
  p span {
    display: none;
  }
  .believablehover p:hover span {
    display: inline;
  }
</style>
<p><a href="/">Tap me</a><span>You tapped!</span></p>