mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Merge pull request #2093 from chillu/pulls/resize-infinite
BUG Resize infinite loops in IE8 (fixes #575)
This commit is contained in:
commit
31a138b636
@ -4,6 +4,25 @@ jQuery.noConflict();
|
||||
* File: LeftAndMain.js
|
||||
*/
|
||||
(function($) {
|
||||
|
||||
var windowWidth, windowHeight;
|
||||
$(window).bind('resize.leftandmain', function(e) {
|
||||
// Entwine's 'fromWindow::onresize' does not trigger on IE8. Use synthetic event.
|
||||
var cb = function() {$('.cms-container').trigger('windowresize');};
|
||||
|
||||
// Workaround to avoid IE8 infinite loops when elements are resized as a result of this event
|
||||
if($.browser.msie && parseInt($.browser.version, 10) < 9) {
|
||||
var newWindowWidth = $(window).width(), newWindowHeight = $(window).height();
|
||||
if(newWindowWidth != windowWidth || newWindowHeight != windowHeight) {
|
||||
windowWidth = newWindowWidth;
|
||||
windowHeight = newWindowHeight;
|
||||
cb();
|
||||
}
|
||||
} else {
|
||||
cb();
|
||||
}
|
||||
});
|
||||
|
||||
// setup jquery.entwine
|
||||
$.entwine.warningLevel = $.entwine.WARN_LEVEL_BESTPRACTISE;
|
||||
$.entwine('ss', function($) {
|
||||
@ -133,7 +152,10 @@ jQuery.noConflict();
|
||||
|
||||
fromWindow: {
|
||||
onstatechange: function(){ this.handleStateChange(); },
|
||||
onresize: function(){ this.redraw(); }
|
||||
},
|
||||
|
||||
'onwindowresize': function() {
|
||||
this.redraw();
|
||||
},
|
||||
|
||||
'from .cms-panel': {
|
||||
|
@ -4,8 +4,22 @@
|
||||
* On resize of any close the open treedropdownfields
|
||||
* as we'll need to redo with widths
|
||||
*/
|
||||
$(window).resize(function() {
|
||||
$('.TreeDropdownField').closePanel();
|
||||
var windowWidth, windowHeight;
|
||||
$(window).bind('resize.treedropdownfield', function() {
|
||||
// Entwine's 'fromWindow::onresize' does not trigger on IE8. Use synthetic event.
|
||||
var cb = function() {$('.TreeDropdownField').closePanel();};
|
||||
|
||||
// Workaround to avoid IE8 infinite loops when elements are resized as a result of this event
|
||||
if($.browser.msie && parseInt($.browser.version, 10) < 9) {
|
||||
var newWindowWidth = $(window).width(), newWindowHeight = $(window).height();
|
||||
if(newWindowWidth != windowWidth || newWindowHeight != windowHeight) {
|
||||
windowWidth = newWindowWidth;
|
||||
windowHeight = newWindowHeight;
|
||||
cb();
|
||||
}
|
||||
} else {
|
||||
cb();
|
||||
}
|
||||
});
|
||||
|
||||
var strings = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user