Skip to content

Instantly share code, notes, and snippets.

@rgkimball
Created March 8, 2015 21:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rgkimball/6aaa4017037744396ed3 to your computer and use it in GitHub Desktop.
Save rgkimball/6aaa4017037744396ed3 to your computer and use it in GitHub Desktop.
:hovering jQuery element state
$(document).on({
mouseenter: function (evt) {
$(evt.target).data('hovering', true);
},
mouseleave: function (evt) {
$(evt.target).data('hovering', false);
}
}, "*");
jQuery.expr[":"].hovering = function (elem) {
return $(elem).data('hovering') ? true : false;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment