Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery UI dialog positioning : adjust position top by 20px -

I have a dialog that gets filled by an ajax call. I want to limit the max-height of dialog and also allow it to be scroll-able if this max-height is exceeded. The code below does exactly what I want.

The catch is I can not move the top of the dialog from the top position. I can move it left and right. I can't use center either as the dialog is displayed in a large scroll-able window. If I use firebug I can adjust the top property but cannot find where it is being set to zero.

$("#your-dialog-id").dialog({     open: function(event, ui) {         $(this).css({'max-height': 500, 'overflow-y': 'auto'});     },     autoOpen:false,     modal: true,     resizable: false,     draggable: false,     width: '690',     closeOnEscape: true,     position: 'top' }); 

I want to adjust the dialog's y position so it is 20px from the top of the window. Any idea what I can do?

like image 286
chris loughnane Avatar asked Jun 27 '12 16:06

chris loughnane


2 Answers

Changing the last value solved the problem:

position: ['center',20]  

http://jsfiddle.net/chrisloughnane/wApSQ/3

like image 58
chris loughnane Avatar answered Sep 20 '22 13:09

chris loughnane


The easiest way is:

$("#dialog").dialog({ position: { my: "center", at: "top" } }); 
like image 21
Yogesh Avhad Avatar answered Sep 20 '22 13:09

Yogesh Avhad