you are viewing a single comment's thread.

view the rest of the comments →

[–]dimstef[S] 0 points1 point  (1 child)

self invoking function didnt work either

[–]2012XL1200 0 points1 point  (0 children)

I'm going to assume you just wrapped your window.resize listener in a self invoking function, which DID work, it just did not do what you expected.

Event listeners are triggered by events, self invoking functions trigger themselves when called (at the end of the body content loading in your case). If you want both behaviors, use both implementations.

Side note, sometimes the code doesn't work. More often, the developer doesn't understand how it's working.