BUGFIX Fixed resizing problem with LeftAndMain.js->resizeChildren() caused by jQuery UI tabs and FOUC

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/cms/trunk@92774 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Ingo Schommer 2009-11-21 03:17:52 +00:00
parent 2683a5ae62
commit 4decff9907

View File

@ -58,23 +58,29 @@ var ss_MainLayout;
this._setupPinging();
this._resizeChildren();
// artificially delay the resize event 200ms
// to avoid overlapping height changes in different onresize() methods
// HACK Delay resizing to give jquery-ui tabs a change their dimensions
// through dynamically added css classes
$(window).resize(function () {
var timerID = "timerLeftAndMainResize";
if (window[timerID]) clearTimeout(window[timerID]);
window[timerID] = setTimeout(function() {self._resizeChildren();}, 200);
window[timerID] = setTimeout(function() {
self._resizeChildren();
}, 200);
});
// If tab has no nested tabs, set overflow to auto
$(this).find('.tab').not(':has(.tab)').css('overflow', 'auto');
// trigger resize whenever new tabs are shown
// @todo This is called multiple times when tabs are loaded
this.find('.ss-tabset').live('tabsshow', function() {self._resizeChildren();});
// @todo Doesn't resize properly if the response doesn't contain a tabset (see above)
//$('#Form_EditForm').bind('loadnewpage', function() {self._resizeChildren();});
$('#Form_EditForm').bind('loadnewpage', function() {
// HACK Delay resizing to give jquery-ui tabs a change their dimensions
// through dynamically added css classes
var timerID = "timerLeftAndMainResize";
if (window[timerID]) clearTimeout(window[timerID]);
window[timerID] = setTimeout(function() {
self._resizeChildren();
}, 200);
});
this._super();
},