My implementation of Jquery dialog is as follows:
<body>
<div id="comments_dialog">
Insert a comment
<form>
<input type="text" id="search" name="q">
</form>
</div>
....
</body>
dialog = $( "#comment_dialog" ).dialog({
autoOpen: false,
height: 400,
width: 350,
dialogClass: "flora",
modal: true,
buttons: {
"New Comment": addComment,
Cancel: function() {
dialog.dialog( "close" );
}
},
close: function() {
form[ 0 ].reset();
}
});
My webpage contains a lot of scrollable data.
The current issue I am facing is that the dialog box appears in the middle of the page, and I want it to be positioned in the center of the CURRENT screen, eliminating the need for scrolling.
Is there a way to achieve this?
UPDATE
After trying out various suggestions, I have set the CSS position to fixed like so:
.flora.ui-front {
z-index: 1000 !important;
position:fixed !important;
}
.flora.ui-dialog {
z-index: 1001 !important;
position:fixed !important;
}
However, I have learned that using a fixed position may cause conflicts with zIndex. What alternatives do I have if I still want the dialog box to appear on top and centered on the current screen?