mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Position: Cleanup variable definitions, move undefined vars to the top
This commit is contained in:
parent
f594c0623a
commit
d3dc637b65
17
ui/jquery.ui.position.js
vendored
17
ui/jquery.ui.position.js
vendored
@ -86,17 +86,13 @@ $.fn.position = function( options ) {
|
||||
// make a copy, we don't want to modify arguments
|
||||
options = $.extend( {}, options );
|
||||
|
||||
var target = $( options.of ),
|
||||
var atOffset, targetWidth, targetHeight, targetOffset, basePosition,
|
||||
target = $( options.of ),
|
||||
within = $.position.getWithinInfo( options.within ),
|
||||
scrollInfo = $.position.getScrollInfo( within ),
|
||||
targetElem = target[0],
|
||||
collision = ( options.collision || "flip" ).split( " " ),
|
||||
offsets = {},
|
||||
atOffset,
|
||||
targetWidth,
|
||||
targetHeight,
|
||||
targetOffset,
|
||||
basePosition;
|
||||
offsets = {};
|
||||
|
||||
if ( targetElem.nodeType === 9 ) {
|
||||
targetWidth = target.width();
|
||||
@ -173,7 +169,8 @@ $.fn.position = function( options ) {
|
||||
basePosition.top += atOffset[ 1 ];
|
||||
|
||||
return this.each(function() {
|
||||
var elem = $( this ),
|
||||
var collisionPosition, using,
|
||||
elem = $( this ),
|
||||
elemWidth = elem.outerWidth(),
|
||||
elemHeight = elem.outerHeight(),
|
||||
marginLeft = parseCss( this, "marginLeft" ),
|
||||
@ -181,9 +178,7 @@ $.fn.position = function( options ) {
|
||||
collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) + scrollInfo.width,
|
||||
collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) + scrollInfo.height,
|
||||
position = $.extend( {}, basePosition ),
|
||||
myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() ),
|
||||
collisionPosition,
|
||||
using;
|
||||
myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() );
|
||||
|
||||
if ( options.my[ 0 ] === "right" ) {
|
||||
position.left -= elemWidth;
|
||||
|
Loading…
Reference in New Issue
Block a user