Forum Moderators: open
I don't need it to do anything other than to give me the object id for each object that falls within the range provided.
We are already detecting mouseovers on individual objects within a div (by div id) and capturing the X,Y coordinates. I just need to know if you can trick the browser into thinking it is over something with just the range and adding matches to a new array of matched objects.
Anyone have any ideas/suggestions?
Thank you!
This gives the element at the screen point(x,y). If there are layered elements, it gives the topmost.
For the rest it's going to be trickier. You'll indeed have to loop through your elements array, testing to see if one contains that point.
That's assuming that your elements are absolutely positioned, L,T,W & H properties held directly on the style attribute (not sheet). It is (almost) entirely possible, even if the elements are part of the flow, with dimensions dictated by content. Then you'd need to get the offset properties. The next problem then, is that you'll need to make sure that your offset L & T are given from the body element, which requires a carefully crafted function.
Sorry for the vagueness. Here's a relevant link:
Let us know how you get on.
My current thought is on looking at every object on the page and building an array of the objects and their coordinates. I could then do a comparison against my original range.
So, I need to know if there is a way to look at the object in the div and to get it's true height and width to calculate the coordinates correctly. I have a situation with text where the user can set the div width wider than the actual text. So if I use the div for matching, it will match the div if the original range is wide enough, but not the text if you are outside the text width, but not the div.
I'm thinking I need something like offsetWidth. I have no problem understanding examples, I just don't have a lot of javascript experience to know all of the syntax and functions available. If you have any ideas on capturing the true coordinates, I think I can handle the rest. :)
Appreciate the help!