jquery-nearest
jquery-nearest copied to clipboard
Nearest element at the distance of X pixels
Is it possible? I want to limit the search area to X pixels. At first I thought that tolerance is the thing but it doesn't seem to be what I am looking for.
I presume you mean limiting based on direct distance, not just width/height calculations? Unfortunately that's not possible at the moment; I like the idea though.
For your use case, are you looking for a minimum or maximum distance, or a combination of both?
The original problem I want to solve is -- the touch event's target is not accurately determined and I tweak it a bit by selecting elements that are usually supposed to be clicked on a typical form. https://github.com/cubiq/iscroll/issues/822
Then I found out about document.elementFromPoint and then jquery-nearest plugin.