Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Position jquery UI dialog

How can I position the jquery UI dialog SPECIFICALLY, so that it goes to a position not defined by center, top, etc.

Thanks, I have tried to be as specific as posible.

like image 508
H Bellamy Avatar asked Nov 04 '11 14:11

H Bellamy


People also ask

How to position jQuery dialog?

Syntax: $( ". selector" ). dialog({ position: { my: "left top", at: "left bottom", of: button } });

What is jQuery ui dialog?

The jQuery UI dialog method is used to create a basic dialog window which is positioned into the viewport and protected from page content. It has a title bar and a content area, and can be moved, resized and closed with the 'x' icon by default.

What is UI positioning?

The jQuery UI . position() method allows you to position an element relative to the window, document, another element, or the cursor/mouse, without worrying about offset parents.

What is the difference between position and offset in jQuery?

Difference between offset() and position() Method:The jQuery UI offset() is relative to the document. The jQuery UI position() is relative to the parent element. When you want to position a new element on top of another one which is already existing, its better to use the jQuery offset() method.


1 Answers

Using the position option : http://jqueryui.com/position/

Specifies where the dialog should be displayed. Possible values:

1) a single string representing position within viewport: 'center', 'left', 'right', 'top', 'bottom'.
2) an array containing an x,y coordinate pair in pixel offset from left, top corner of viewport (e.g. [350,100])
3) an array containing x,y position string values (e.g. ['right','top'] for top right corner).

For example : $( ".selector" ).dialog( "option", "position", [350,100] );

like image 74
Guillaume Cisco Avatar answered Oct 09 '22 21:10

Guillaume Cisco