Fernando,
I got around this by disabling refreshOnResize on page load:
Elastic.configuration.refreshOnResize = false;
Then, I use a custom script to detect screen resize and fire
Elastic.refresh():
viewportwidth = document.documentElement.clientWidth; // Old, but
IE7 safe.
viewportheight = document.documentElement.clientHeight;
function resize_detect() {
var currentSize = getViewportSize();
if (currentSize != g_prevSize) {
g_prevSize = currentSize;
viewportwidth = document.documentElement.clientWidth;
viewportheight = document.documentElement.clientHeight;
resizeEvent(g_prevSize,viewportheight);
}
}
function init_resize_detect() {
window.g_prevSize = getViewportSize();
setInterval(resize_detect, 1000);
}
function getViewportSize() {
if (typeof window.innerWidth != 'undefined') {
width = window.innerWidth;
} else if (typeof document.documentElement != 'undefined' &&
typeof document.documentElement.clientWidth !=
'undefined' &&
document.documentElement.clientWidth != 0) {
width = document.documentElement.clientWidth;
} else {
width = document.getElementsByTagName('body').clientWidth;
}
return width;
}
init_resize_detect();
function resizeEvent(viewportwidth,viewportheight) {
// Reset elastic layout
Elastic.refresh();
}
I'm sure my solution is crude, but it works. The crash is prevented on
iOS.
I originally wrote this script to correct IE7 from crashing when
detecting media queries with respond.js (now part of Modernizer).
Window.resize() hangs IE7 for me.
Ironically, Elastic's native resizing DOES work correctly in IE7 (as
well as my method above). Good job on that!