@ -649,14 +649,14 @@ $.fn.popup = function(parameters) {
var
is2D = ( $node . css ( 'transform' ) === 'none' ) ,
isStatic = ( $node . css ( 'position' ) === 'static' ) ,
isHTML = $node . is ( 'html ' )
isBody = $node . is ( 'body ' )
;
while ( parentNode && ! isHTML && isStatic && is2D ) {
while ( parentNode && ! isBody && isStatic && is2D ) {
parentNode = parentNode . parentNode ;
$node = $ ( parentNode ) ;
is2D = ( $node . css ( 'transform' ) === 'none' ) ;
isStatic = ( $node . css ( 'position' ) === 'static' ) ;
isHTML = $node . is ( 'html ' ) ;
isBody = $node . is ( 'body ' ) ;
}
}
return ( $node && $node . length > 0 )
@ -765,6 +765,18 @@ $.fn.popup = function(parameters) {
popup = calculations . popup ;
parent = calculations . parent ;
if ( module . should . centerArrow ( calculations ) ) {
module . verbose ( 'Adjusting offset to center arrow on small target element' ) ;
if ( position == 'top left' || position == 'bottom left' ) {
offset += ( target . width / 2 )
offset -= settings . arrowPixelsFromEdge ;
}
if ( position == 'top right' || position == 'bottom right' ) {
offset -= ( target . width / 2 )
offset += settings . arrowPixelsFromEdge ;
}
}
if ( target . width === 0 && target . height === 0 && ! module . is . svg ( target . element ) ) {
module . debug ( 'Popup target is hidden, no action taken' ) ;
return false ;
@ -1058,6 +1070,12 @@ $.fn.popup = function(parameters) {
}
} ,
should : {
centerArrow : function ( calculations ) {
return ! module . is . basic ( ) && calculations . target . width <= ( settings . arrowPixelsFromEdge * 2 ) ;
}
} ,
is : {
offstage : function ( distanceFromBoundary , position ) {
var
@ -1080,6 +1098,9 @@ $.fn.popup = function(parameters) {
svg : function ( element ) {
return module . supports . svg ( ) && ( element instanceof SVGGraphicsElement ) ;
} ,
basic : function ( ) {
return $module . hasClass ( className . basic ) ;
} ,
active : function ( ) {
return $module . hasClass ( className . active ) ;
} ,
@ -1392,8 +1413,11 @@ $.fn.popup.settings = {
// specify position to appear even if it doesn't fit
lastResort : false ,
// number of pixels from edge of popup to pointing arrow center (used from centering)
arrowPixelsFromEdge : 20 ,
// delay used to prevent accidental refiring of animations due to user error
delay : {
delay : {
show : 50 ,
hide : 70
} ,
@ -1437,6 +1461,7 @@ $.fn.popup.settings = {
className : {
active : 'active' ,
basic : 'basic' ,
animating : 'animating' ,
dropdown : 'dropdown' ,
fluid : 'fluid' ,