I can get an object if it's moused over. I can get the coordinates of the mouse at any given time. How do I get an object given it's coordinates - if they are different from the mouse?
Essentially the user is dropping a div on a certain place on the screen. Since the div is wider than the mouse cursor, I need to know what object the corner of the div is over (not what the mouse is over). Is there a way to raise a mousemove event in JS - passing it the coordinates?
Thanks
Just a quick post script for others who read this post. Although I did not choose the jquery for my answer, it may be the answer for you. This appears to be a very flexible feature rich solution for many of the client side tools we want to offer.
There's no way to raise a mousemove and have it fill in the resulting target element properties, no.
There is a way to get an element from arbitrary co-ordinates, but you won't like it much. It involves walking over each page element and calculating its dimensions (from offsetLeft/Top/Parent) and which elements overlay which other elements (from calculated styles ‘position’ and ‘z-index’)... essentially, re-implementing part of the browser's own layout engine in script. And if you have elements with ‘overflow’ scroll/auto you have even more calculation to do.
If you have a limited case (eg. you can only drop the div somewhere amongst a set of other statically-positioned divs) it can be manageable, but the general case is quite hard and in no way fun. (Maybe someone somewhere has packaged such a feature up into a library or framework plugin, but I've not met one yet.)
If you can find another way to make your drag'n'drop behave nicely that doesn't require you to do this, then do that!