jquery ui dialog top always > 0
I'm using the jquery ui dialog for viewing a form.
This form has a large height value, so the top of the dialog is 0px.
I want to change this because there is a menu bar at the top of my window.
Is this possible?
use the position property
$('#some_dialog_selector').dialog({position:['center',10]});
this will open the dialog centered horizontally and 10 pixels from the top of the viewport..
If I understand you correctly, you dialog is covering the menubar at the top of the window. So you want o manually place this dialog lower.
You can use the 'position' option. It can be 'right', 'left', 'bottom' or 'top' as below -
`$("#register-dialog").dialog({
bgiframe: true,
height: 300,
width: 400,
modal: true,
position: 'bottom'
buttons: {`
Or you can position it at "right top". As shown here at the jquery site -
Specifies where the dialog should be displayed. Possible values: 'center', 'left', 'right', 'top', 'bottom', or an array containing a coordinate pair (in pixel offset from top left of viewport) or the possible string values (e.g. ['right','top'] for top right corner).
精彩评论