diff options
author | Benjamin Sterling <benjamin.sterling@kenzomedia.com> | 2011-07-11 19:49:56 -0400 |
---|---|---|
committer | Benjamin Sterling <benjamin.sterling@kenzomedia.com> | 2011-07-11 19:49:56 -0400 |
commit | d5452c0ec27219c3564522b852f83ca9757bed84 (patch) | |
tree | db5215815a1fdbd18cb634379964f327c8a2fafe /ui | |
parent | 0245b72af87d3022f5dd780d03ff03d4751eca64 (diff) | |
download | jquery-ui-d5452c0ec27219c3564522b852f83ca9757bed84.tar.gz jquery-ui-d5452c0ec27219c3564522b852f83ca9757bed84.zip |
Position: Add flip-classes. Fixes #5937 - Position: Add ability to determine if the element is flipped via css
Diffstat (limited to 'ui')
-rw-r--r-- | ui/jquery.ui.position.js | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/ui/jquery.ui.position.js b/ui/jquery.ui.position.js index 3bae0d010..23a98b491 100644 --- a/ui/jquery.ui.position.js +++ b/ui/jquery.ui.position.js @@ -204,7 +204,8 @@ $.fn.position = function( options ) { offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ], my: options.my, at: options.at, - within: within + within: within, + elem : elem }); } }); @@ -265,6 +266,9 @@ $.ui.position = { return; } + data.elem + .removeClass( "ui-flipped-left ui-flipped-right" ); + var within = data.within, win = $( window ), isWindow = $.isWindow( data.within[0] ), @@ -283,6 +287,10 @@ $.ui.position = { -data.targetWidth, offset = -2 * data.offset[ 0 ]; if ( overLeft < 0 || overRight > 0 ) { + + data.elem + .addClass( "ui-flipped-" + ( overLeft < 0 ? "right" : "left" ) ); + position.left += myOffset + atOffset + offset; } }, @@ -290,6 +298,10 @@ $.ui.position = { if ( data.at[ 1 ] === center ) { return; } + + data.elem + .removeClass( "ui-flipped-top ui-flipped-bottom" ); + var within = data.within, win = $( window ), isWindow = $.isWindow( data.within[0] ), @@ -308,6 +320,10 @@ $.ui.position = { -data.targetHeight, offset = -2 * data.offset[ 1 ]; if ( overTop < 0 || overBottom > 0 ) { + + data.elem + .addClass( "ui-flipped-" + ( overTop < 0 ? "bottom" : "top" ) ); + position.top += myOffset + atOffset + offset; } } |