From 5d113c01a513a660896c4d0f800d48ee442f391f Mon Sep 17 00:00:00 2001 From: jlukic Date: Mon, 13 Jul 2015 17:22:25 -0400 Subject: [PATCH] #2526 Popup fluid width is now set by its parent DOM element, not its offsetContext (i.e. thing with position: relative) --- src/definitions/modules/popup.js | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/src/definitions/modules/popup.js b/src/definitions/modules/popup.js index 6c61447d0..30c310ec1 100644 --- a/src/definitions/modules/popup.js +++ b/src/definitions/modules/popup.js @@ -484,6 +484,14 @@ $.fn.popup = function(parameters) { } }; + // add in container if fluid + if( settings.setFluidWidth && module.is.fluid() ) { + calculations.container = { + width: $popup.parent().outerWidth() + }; + calculations.popup.width = calculations.container.width; + } + // add in margins if inline calculations.target.margin.top = (settings.inline) ? parseInt( window.getComputedStyle(targetElement).getPropertyValue('margin-top'), 10) @@ -669,6 +677,7 @@ $.fn.popup = function(parameters) { popupOffset, distanceFromBoundary ; + calculations = calculations || module.get.calculations(); position = position || $module.data(metadata.position) || settings.position; @@ -830,16 +839,17 @@ $.fn.popup = function(parameters) { } module.debug('Position is on stage', position); module.remove.attempts(); - module.set.fluidWidth(calculations); module.remove.loading(); + if( settings.setFluidWidth && module.is.fluid() ) { + module.set.fluidWidth(calculations); + } return true; }, fluidWidth: function(calculations) { calculations = calculations || module.get.calculations(); - if( settings.setFluidWidth && $popup.hasClass(className.fluid) ) { - $popup.css('width', calculations.parent.width); - } + module.debug('Automatically setting element width to parent width', calculations.parent.width); + $popup.css('width', calculations.container.width); }, visible: function() { @@ -980,6 +990,9 @@ $.fn.popup = function(parameters) { animating: function() { return ( $popup && $popup.hasClass(className.animating) ); }, + fluid: function() { + return ( $popup && $popup.hasClass(className.fluid)); + }, visible: function() { return $popup && $popup.hasClass(className.visible); },