Changeset 5595
- Timestamp:
- 05/14/08 16:42:45 (3 months ago)
- Files:
-
- 1 modified
-
trunk/ui/ui.dialog.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ui/ui.dialog.js
r5582 r5595 178 178 179 179 position: function(pos) { 180 var wnd = $(window), doc = $(document), top = doc.scrollTop(), left = doc.scrollLeft(), minTop = top; 180 var wnd = $(window), doc = $(document), 181 pTop = doc.scrollTop(), pLeft = doc.scrollLeft(), 182 minTop = pTop; 183 181 184 if ($.inArray(pos, ['center','top','right','bottom','left']) >= 0) { 182 pos = [pos == 'right' || pos == 'left' ? pos : 'center', pos == 'top' || pos == 'bottom' ? pos : 'middle']; 185 pos = [ 186 pos == 'right' || pos == 'left' ? pos : 'center', 187 pos == 'top' || pos == 'bottom' ? pos : 'middle' 188 ]; 183 189 } 184 190 if (pos.constructor != Array) { … … 186 192 } 187 193 if (pos[0].constructor == Number) { 188 left += pos[0];194 pLeft += pos[0]; 189 195 } else { 190 196 switch (pos[0]) { 191 197 case 'left': 192 left += 0;198 pLeft += 0; 193 199 break; 194 200 case 'right': 195 left += (wnd.width()) - (this.uiDialog.width());201 pLeft += (wnd.width()) - (this.uiDialog.width()); 196 202 break; 197 203 case 'center': 198 204 default: 199 left += (wnd.width() / 2) - (this.uiDialog.width() / 2);205 pLeft += (wnd.width() / 2) - (this.uiDialog.width() / 2); 200 206 } 201 207 } 202 208 if (pos[1].constructor == Number) { 203 top += pos[1];209 pTop += pos[1]; 204 210 } else { 205 211 switch (pos[1]) { 206 212 case 'top': 207 top += 0;213 pTop += 0; 208 214 break; 209 215 case 'bottom': 210 top += (wnd.height()) - (this.uiDialog.height());216 pTop += (wnd.height()) - (this.uiDialog.height()); 211 217 break; 212 218 case 'middle': 213 219 default: 214 top += (wnd.height() / 2) - (this.uiDialog.height() / 2);220 pTop += (wnd.height() / 2) - (this.uiDialog.height() / 2); 215 221 } 216 222 } 217 top = top < minTop ? minTop : top; 218 this.uiDialog.css({top: top, left: left}); 219 }, 220 223 224 // prevent the dialog from being too high (make sure the titlebar 225 // is accessible) 226 pTop = Math.max(pTop, minTop); 227 this.uiDialog.css({top: pTop, left: pLeft}); 228 }, 229 221 230 open: function() { 222 231 this.overlay = this.options.modal ? new $.ui.dialog.overlay(this) : null;