One option is to create an array of div-dimension objects. (Not to be confused with the divs themselves ... IE7 perf is frustrating when you read the dimensions of an object.)
These objects consist of a pointer to a div, their sizes (four dots ... say top, left, bottom and right) and possibly a dirty bit. (A dirty bit is needed only when resizing.
Then you can iterate over the array and check the sizes. This requires O (n) to do this every time you move the mouse. Perhaps you can improve the approach using binary search a bit ... maybe.
If you apply the binary search style, one way is to save 4 arrays. Each of them has one measurement point, and then a binary search on all four. O (4logn) = O (logn).
I'm not saying that I recommend any of them, but they CAN work.
Rob Rolnick Sep 08 '08 at 2:28 2008-09-08 02:28
source share