When I have a modal JQuery dialog open in IE8, my CPU usage goes to 100% (no, actually 50, but that's 100% of one core). If I break developer tools, it seems that it's a lot of resize events firing (I don't do any volontary resizing). Has someone else encountered this issue and knows how to fix it?
+3
A:
I've seen things like this happen when something is filling a container at 100% width and height, and that container has overflow:auto. Which makes it bounce back and forth endlessly trying to fit in the container, but then the container adds or removes scrollbars. Don't know if this is applicable to your situation, but maybe something similar.
lod3n
2009-09-25 23:51:39
What do you mean with filling a container? There does appear scrollbars on the document for me when I popup the dialog, so you're probably at least partly right. However, the body is not even close to filled with things.
erikkallen
2009-09-26 08:14:33
I mean when an inner element is the same size as (or slightly bigger than) a parent element. If you're seeing scrollbars, then it looks like this is happening to you. You need to find out what which element is doing this, and style it so it remains smaller than the parent element. The CPU usage is due to the repeated reflow that occurs when scrollbars are added and removed repeatedly. You might consider simply setting the body to overflow:hidden while the dialog appears, then back to whatever it was after it's closed.
lod3n
2009-09-26 19:34:44
Thanks. This solution works, but is a little too cumbersome (think nested dialogs). I will accept it if nobody comes up with a better idea.
erikkallen
2009-09-26 20:26:30
Again, the only thing which takes up 100% (or even close to that) of the body is the dialog overlay.
erikkallen
2009-09-26 20:29:59
Sorry for accepting my own answer, but I do think it is the best solution. Not supported by IE6, but IE6 has a different code path in the relevant jQuery code anyway (and I don't know if there is a problem).
erikkallen
2009-09-29 19:08:21