From 4decff99077cf8c6574352267be5819235bdc613 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Sat, 21 Nov 2009 03:17:52 +0000 Subject: [PATCH] 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 --- javascript/LeftAndMain.js | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/javascript/LeftAndMain.js b/javascript/LeftAndMain.js index 406f0b02..d3f7c636 100644 --- a/javascript/LeftAndMain.js +++ b/javascript/LeftAndMain.js @@ -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(); },