我正在使用jQuery UI来显示一个对话框,我希望它始终保持在同一位置,而不管滚动状态如何。所以我刚刚添加了css代码
.ui-dialog {
position: fixed;
}
现在,如果将对话框拖到底部,则可以将其移出屏幕以使其完全消失。谁知道如何防止这种情况? 请参阅此小提琴进行演示:https://jsfiddle.net/d0pgfwk7/
答案 0 :(得分:1)
我终于解决了我的问题。解决方案不是使用对话框的可拖动设置,而是使用小部件本身。所以我的代码现在看起来像这样:
$("#dialog").dialog(
{
draggable: false,
dialogClass: 'my-dialog'
}
});
$('.my-dialog').draggable({
containment: 'window'
});
答案 1 :(得分:0)
From what I can get you are saying the jquery dialog box is draggable. If this is the case it is pretty simple fix just use
draggable: false
See the fiddle here https://jsfiddle.net/d0pgfwk7/
EDIT : Please look at fiddle here
http://jsfiddle.net/tj_vantoll/LZ9SR/
For more details refer this link https://bugs.jqueryui.com/ticket/8741