0

I have a position:fixed Header which I want to center horizontally. So I wrote a function which is executed at the windwo.resize- and document.ready-event to change margin-left of the header. But thats not the point because everything works fine.

Sometimes after my MacBook is closed (hibernating) or I've switched to another Chrome-tab or another OSX-workspace my header isn't centered anymore. It seems like OSX is furtively resizing the window so the CSS Code changes, but it never changes back without resizing the browser window manually. But the problem occurs not every time...

Thats why I want to execute some code after my window is focused again to prevent from this ugly behavior.

Another idea: Does it maybe have to do with the difference between the document.resize- and window.resize-event? What should I use?

Dennis Zoma
  • 2,621
  • 2
  • 17
  • 27

0 Answers0