mirror of
https://github.com/jquery/jquery-ui.git
synced 2024-11-21 11:04:24 +00:00
Dialog: Fixed position parsing.
This commit is contained in:
parent
751d7c521b
commit
fd976793a9
52
ui/jquery.ui.dialog.js
vendored
52
ui/jquery.ui.dialog.js
vendored
@ -379,39 +379,39 @@ $.widget("ui.dialog", {
|
||||
var myAt = [],
|
||||
offset = [0, 0];
|
||||
|
||||
position = position || $.ui.dialog.defaults.position;
|
||||
|
||||
// deep extending converts arrays to objects in jQuery <= 1.3.2 :-(
|
||||
// if (typeof position == 'string' || $.isArray(position)) {
|
||||
// myAt = $.isArray(position) ? position : position.split(' ');
|
||||
|
||||
if (position && (typeof positon == "string" || typeof position == "object")) {
|
||||
if (typeof position == 'string' || '0' in position) {
|
||||
myAt = position.split ? position.split(' ') : [position[0], position[1]];
|
||||
if (myAt.length == 1) {
|
||||
myAt[1] = myAt[0];
|
||||
}
|
||||
if (typeof position == 'string' || (typeof position == 'object' && '0' in position)) {
|
||||
myAt = position.split ? position.split(' ') : [position[0], position[1]];
|
||||
if (myAt.length == 1) {
|
||||
myAt[1] = myAt[0];
|
||||
}
|
||||
|
||||
$.each(['left', 'top'], function(i, offsetPosition) {
|
||||
if (+myAt[i] == myAt[i]) {
|
||||
offset[i] = myAt[i];
|
||||
myAt[i] = offsetPosition;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
if ('left' in position) {
|
||||
myAt[0] = 'left';
|
||||
offset[0] = position.left;
|
||||
} else if ('right' in position) {
|
||||
myAt[0] = 'right';
|
||||
offset[0] = -position.right;
|
||||
$.each(['left', 'top'], function(i, offsetPosition) {
|
||||
if (+myAt[i] == myAt[i]) {
|
||||
offset[i] = myAt[i];
|
||||
myAt[i] = offsetPosition;
|
||||
}
|
||||
});
|
||||
} else if (typeof position == 'object') {
|
||||
if ('left' in position) {
|
||||
myAt[0] = 'left';
|
||||
offset[0] = position.left;
|
||||
} else if ('right' in position) {
|
||||
myAt[0] = 'right';
|
||||
offset[0] = -position.right;
|
||||
}
|
||||
|
||||
if ('top' in position) {
|
||||
myAt[1] = 'top';
|
||||
offset[1] = position.top;
|
||||
} else if ('bottom' in position) {
|
||||
myAt[1] = 'bottom';
|
||||
offset[1] = -position.bottom;
|
||||
}
|
||||
if ('top' in position) {
|
||||
myAt[1] = 'top';
|
||||
offset[1] = position.top;
|
||||
} else if ('bottom' in position) {
|
||||
myAt[1] = 'bottom';
|
||||
offset[1] = -position.bottom;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user