1

Possible Duplicate:
jquery find element at a particular position

In the browser, if I am given either 1. css locations ( top, left ) or 2. absolute locations (offset.x, offset.y, for example), is there a way to get what div is in that location beside a brute force search through all the divs on the screen? Or even a brute force through the subset of divs I care about?

Community
  • 1
  • 1
xiaolingxiao
  • 4,793
  • 5
  • 41
  • 88
  • Like this? [jquery find element at a particular position](http://stackoverflow.com/questions/3942776/jquery-find-element-at-a-particular-position) – gray state is coming Sep 08 '12 at 20:13
  • http://stackoverflow.com/questions/1259585/get-element-at-specified-position-javascript – jjm Sep 08 '12 at 20:13
  • `elementFromPoint` uses screen coordinates and acts differently when zooming/scrolling. It's not exactly what the OP wants, I believe. – pimvdb Sep 08 '12 at 20:15

1 Answers1

2

You could do something like this:

var element = document.elementFromPoint(x, y);
var $element = $(element);

If you e.g, want the ID you then do the following:

$element.attr('id');
ffffff01
  • 5,068
  • 11
  • 52
  • 61