Browse Source

Refix #1256, adds new setting for adjusting fluid width on display

1.0
jlukic 10 years ago
parent
commit
633e3fb706
1 changed files with 26 additions and 14 deletions
  1. 40
      src/definitions/modules/popup.js

40
src/definitions/modules/popup.js

@ -111,12 +111,21 @@ $.fn.popup = function(parameters) {
? $target.next(settings.selector.popup) ? $target.next(settings.selector.popup)
: false : 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() { reposition: function() {
@ -431,7 +440,7 @@ $.fn.popup = function(parameters) {
top : (popup.offset.top < boundary.top), top : (popup.offset.top < boundary.top),
bottom : (popup.offset.top + popup.height > boundary.bottom), bottom : (popup.offset.top + popup.height > boundary.bottom),
right : (popup.offset.left + popup.width > boundary.right), right : (popup.offset.left + popup.width > boundary.right),
left : (popup.offset.left < boundary.left)
left : false
}; };
} }
// return only boundaries that have been surpassed // return only boundaries that have been surpassed
@ -488,13 +497,8 @@ $.fn.popup = function(parameters) {
popupWidth = $popup.outerWidth(), popupWidth = $popup.outerWidth(),
popupHeight = $popup.outerHeight(), 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, distanceAway = settings.distanceAway,
@ -608,8 +612,10 @@ $.fn.popup = function(parameters) {
.addClass(position) .addClass(position)
.addClass(className.loading) .addClass(className.loading)
; ;
console.log('here1');
// check if is offstage // check if is offstage
offstagePosition = module.get.offstagePosition(position); offstagePosition = module.get.offstagePosition(position);
// recursively find new positioning // recursively find new positioning
if(offstagePosition) { if(offstagePosition) {
module.debug('Element is outside boundaries', offstagePosition); module.debug('Element is outside boundaries', offstagePosition);
@ -633,6 +639,9 @@ $.fn.popup = function(parameters) {
else { else {
module.debug('Position is on stage', position); module.debug('Position is on stage', position);
searchDepth = 0; searchDepth = 0;
if( settings.setFluidWidth && $popup.hasClass(className.fluid) ) {
$popup.css('width', $offsetParent.width());
}
$popup.removeClass(className.loading); $popup.removeClass(className.loading);
return true; return true;
} }
@ -939,6 +948,8 @@ $.fn.popup.settings = {
hide : 0 hide : 0
}, },
setFluidWidth : true,
target : false, target : false,
popup : false, popup : false,
inline : false, inline : false,
@ -972,6 +983,7 @@ $.fn.popup.settings = {
active : 'active', active : 'active',
animating : 'animating', animating : 'animating',
dropdown : 'dropdown', dropdown : 'dropdown',
fluid : 'fluid',
loading : 'loading', loading : 'loading',
popup : 'ui popup', popup : 'ui popup',
position : 'top left center bottom right', position : 'top left center bottom right',

Loading…
Cancel
Save