From 633e3fb706440ed0d066d0896ed27529c08ee1f2 Mon Sep 17 00:00:00 2001 From: jlukic Date: Tue, 18 Nov 2014 13:18:20 -0500 Subject: [PATCH] Refix #1256, adds new setting for adjusting fluid width on display --- src/definitions/modules/popup.js | 40 +++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/src/definitions/modules/popup.js b/src/definitions/modules/popup.js index 497a1f819..6a0084152 100644 --- a/src/definitions/modules/popup.js +++ b/src/definitions/modules/popup.js @@ -111,12 +111,21 @@ $.fn.popup = function(parameters) { ? $target.next(settings.selector.popup) : false ; - $offsetParent = (settings.popup) - ? $popup.offsetParent() - : (settings.inline) - ? $target.offsetParent() - : $body - ; + if(settings.popup) { + $popup.addClass(className.loading); + $offsetParent = $popup.offsetParent(); + $popup.removeClass(className.loading); + } + else { + $offsetParent = (settings.inline) + ? $target.offsetParent() + : $body + ; + } + if( $offsetParent.is('html') ) { + module.debug('Page is popups offset parent'); + $offsetParent = $body; + } }, reposition: function() { @@ -431,7 +440,7 @@ $.fn.popup = function(parameters) { top : (popup.offset.top < boundary.top), bottom : (popup.offset.top + popup.height > boundary.bottom), right : (popup.offset.left + popup.width > boundary.right), - left : (popup.offset.left < boundary.left) + left : false }; } // return only boundaries that have been surpassed @@ -488,13 +497,8 @@ $.fn.popup = function(parameters) { popupWidth = $popup.outerWidth(), popupHeight = $popup.outerHeight(), - parentWidth = ( $offsetParent.is('html') ) - ? $offsetParent.find('body').width() - : $offsetParent.outerWidth(), - - parentHeight = ( $offsetParent.is('html') ) - ? $offsetParent.find('body').height() - : $offsetParent.outerHeight(), + parentWidth = $offsetParent.outerWidth(), + parentHeight = $offsetParent.outerHeight(), distanceAway = settings.distanceAway, @@ -608,8 +612,10 @@ $.fn.popup = function(parameters) { .addClass(position) .addClass(className.loading) ; + console.log('here1'); // check if is offstage offstagePosition = module.get.offstagePosition(position); + // recursively find new positioning if(offstagePosition) { module.debug('Element is outside boundaries', offstagePosition); @@ -633,6 +639,9 @@ $.fn.popup = function(parameters) { else { module.debug('Position is on stage', position); searchDepth = 0; + if( settings.setFluidWidth && $popup.hasClass(className.fluid) ) { + $popup.css('width', $offsetParent.width()); + } $popup.removeClass(className.loading); return true; } @@ -939,6 +948,8 @@ $.fn.popup.settings = { hide : 0 }, + setFluidWidth : true, + target : false, popup : false, inline : false, @@ -972,6 +983,7 @@ $.fn.popup.settings = { active : 'active', animating : 'animating', dropdown : 'dropdown', + fluid : 'fluid', loading : 'loading', popup : 'ui popup', position : 'top left center bottom right',