Skip to content

Commit

Permalink
Nasty hack to fix issue with fitToContent() for modal popups with Gan…
Browse files Browse the repository at this point in the history
…try 5.
  • Loading branch information
cheesegrits committed Feb 13, 2016
1 parent 8d9f1be commit 8a40ab6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
2 changes: 1 addition & 1 deletion media/com_fabrik/js/window-min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 12 additions & 2 deletions media/com_fabrik/js/window.js
Original file line number Diff line number Diff line change
Expand Up @@ -420,9 +420,19 @@ Fabrik.Window = new Class({
* Fit the window width to the min of either its content width or the window width
*/
fitToWidth: function () {
var widthPad = 25;
var contentEl = this.window.getElement('.itemContent');
var w = contentEl.getScrollSize().x + 25 < window.getWidth() ? contentEl.getScrollSize().x + 25 : window.getWidth();
this.window.setStyle('width', w);
// nasty hack to work round Gantry 5 wrapping content in a div with id g-page-surround,
// that sets overflow=hidden, thus rendering getScrollSize() useless.
var g = contentEl.getElement('#g-page-surround');
if (g) {
widthPad += 50;
g.setStyle('overflow', 'visible');
}
var w = contentEl.getScrollSize().x + widthPad < window.getWidth() ? contentEl.getScrollSize().x + widthPad : window.getWidth();
if (g) {
g.setStyle('overflow', '');
} this.window.setStyle('width', w);
},

close: function (e)
Expand Down

0 comments on commit 8a40ab6

Please sign in to comment.