开发者

Keep jQuery UI dialog in fixed position

I want to keep a jquery UI d开发者_StackOverflowialog in a fixed position (with respect to content) even if that means it opens outside the browser window. I'm able to control the positioning until the dialog hits the edge of the window, but there appears to be some kind of offset control that is keeping it from opening offscreen.

I'm successfully using this solution for the same issue with datepicker: How to control positioning of jQueryUI datepicker

I wonder if a similar fix is possible for dialog (I tried the obvious change - replacing "datepicker" with "dialog" - doesn't work).

Many thanks.


I had the same challenge which I managed to fix by using Fixed CSS positioning. Initialize the dialog on page load (with autoOpen: false) and then when you want the dialog to be displayed:

$('#dialogContent').parent().css('position', 'Fixed').end().dialog('open');


add the following setting to the dialog.

dialogClass: "dialog-fixed"

in your css declare the class as follows.

.dialog-fixed
{
position:fixed !important;
}

that works for me... as per jquery 2.1.1 and jquery ui 1.11.2

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜