Jeremy
Jeremy

Reputation: 46380

how to center jquery dialog with ui 1.8?

I'm having trouble getting the jquery ui 1.8 dialog to center

I've tried leaving the options default, and setting position: 'center'. When the dialog displayed, the browser window gets scrolled down to the centre of the page, and the dialog is positioned at the bottom left of the window.

This worked fine with jquery 1.3.2 and ui 1.7.2. Is there something new I need to do with this version?

Upvotes: 1

Views: 1470

Answers (3)

Stan Bright
Stan Bright

Reputation: 1375

What about loading the whole library from google. Like this:

google.load("jquery","1.4.2");
google.load("jqueryui","1.8.1");

I have this problem with the positioning of the dialog after upgrading from 1.7.2 to jqueryui 1.8.1 too. However, I think that all the necessary libraries are included in there, so I don't have to include the separate libs.

Any ideas what could be missing or should be done in order to make the dialog work and be positioned in the center?

Upvotes: 0

fgui
fgui

Reputation: 1574

I don't know if it is the correct way to do it, but the following code seems to work.

50 pixels from the top and center:

.dialog( {....
          position : [ null, 50 ],
          ....

I guess that [null,null] will center vertically as well.

But reading the docs, 'center' should work and it should be the default.

Upvotes: 0

Jeremy
Jeremy

Reputation: 46380

Figured it out. You must now include the following js files:

http://scripts/jquery-ui-1.8/jquery.ui.core.js
http://scripts/jquery-ui-1.8/jquery.ui.widget.js
http://scripts/jquery-ui-1.8/jquery.ui.position.js
http://scripts/jquery-ui-1.8/jquery.ui.dialog.js

Upvotes: 2

Related Questions