For the modern browsers it’s easy to fire the window.resize event, but not for IE8…. After several hours of searching, I didn’t find anything.
The only solution I found is the one to resize the HTML that will trigger the event:
function triggerEvent(element, eventName) { var event; if (document.createEvent) { event = document.createEvent("HTMLEvents"); event.initEvent(eventName, true, true); } else { event = document.createEventObject(); event.eventType = eventName; } event.eventName = eventName; if (document.createEvent) element.dispatchEvent(event); else { if (eventName==="resize") { var savedWidth=document.documentElement.style.width; document.documentElement.style.width="99.999999%"; setTimeout(function() { document.documentElement.style.width=savedWidth }, 50); } else element.fireEvent("on" + event.eventType, event); } } triggerEvent(window,'resize')