Tippu
Tippu

Reputation: 1261

JQuery dialog or boxy how to make them in visible area

I am working on the facebook application and my content is dynamic so I am not sure where my link to open the Jquery dialog or boxy link appear.

How can I make the dialog in the visible area of the user(or atleast I want to scroll the screen, where the dialog appears).

By default the modal dialog appears on the center of the screen, but if the page is too long, and the users not able to see the dialog. I am not able to define any specific top or left position, because I don't know the visual area of the user.

Any help is highly appreciated.

Upvotes: 1

Views: 215

Answers (1)

Rohan
Rohan

Reputation: 1805

Get the scroll position using window.pageYOffset. Once you have got the offset, you can position your dialog box accordingly.

Or you can get your dialog's position and use scrollTo to scroll to that position (and back when the dialog is closed)

Upvotes: 1

Related Questions