tags:

views:

96

answers:

4

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?

A: 

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
Jeremy
A: 

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.

zesc
A: 

I am also having this problem and unable to find a solution, on my page I included both files as is from the release files:

<script type="text/javascript" src="/js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="/js/jquery-ui-1.8.custom.min.js"></script>

However, calling the open dialog function still opens the window in the corner to the left in the bottom.

Would this be happening because I am still using a 1.7.2 theme? I tried using the non-minified versions of the same code and it still does not work right..

Fadi Chalfoun
Nevermind me, I found it, there was some old dimensions javascript code that was lurking around and that's what blew it up. Removed the old code and it worked fine.
Fadi Chalfoun
A: 

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?

Stanislav