Faster multiple onmouseover events in IE

I have a webpage with many (up to 100+) html elements on it. Each of them has an onmouseover event registered to run in order to execute some logic and visualization depending on which element is frozen.

I find that in IE there are more onmouseover events that are logged, the longer they fire. Firefox is great and Chrome is even faster!

Does anyone know a solution to this problem. I thought maybe registering one onmousemove event and trying to extract the DOM element from the coordinates, but I'm not sure how to do this or if this is just a mistake in this problem.

+1
source share
1 answer

Attach onmouseover or mousemove (I think both of these bubbles cannot remember) an event for the body, and when you hover over your actual elements, you can handle what you need to do, as it will bubble up to the body where you can handle the element that you actually masked. You can use custom attributes or expando properties of this element to handle everything you need to do when you hover over a specific element.

You really only have to attach events as you need and separate them when you no longer need them. On trivial pages, this is probably not required, but in a scenario like yours, this will improve client-side performance. We used to do such things when I was working, when we would have thousands of form elements on the page.

My two cents, nickyt

+2
source

All Articles