Created
March 5, 2013 12:34
-
-
Save nicbell/5090022 to your computer and use it in GitHub Desktop.
The purpose of this plugin is to be able to detect if a point (X,Y) falls within an element.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function ($) { | |
$.fn.hitTest = function (x, y) { | |
return (x > this.offset().left && x < this.offset().left + this.width()) && (y > this.offset().top && y < this.offset().top + this.height()); | |
}; | |
})(jQuery); | |
var isHit = $(".something").hitTest(90, 100); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment