I am using Jquery UI Dialog to display a popup box
我正在使用Jquery UI对话框来显示弹出框
I have a page with a grid on. Each row has an icon to open a dialog box
我有一个带网格的页面。每行都有一个图标来打开一个对话框
If there are lots of rows and you need to scroll down and click a row at the bottom, then when the dialog box opens it also scrolls the page to the top again
如果有很多行,你需要向下滚动并单击底部的一行,那么当对话框打开时它也会再次将页面滚动到顶部
Is there any way to prevent this happening?
有什么方法可以防止这种情况发生吗?
I just want the dialog box to be opened and the scroll position of the page to be maintained
我只想打开对话框并保持页面的滚动位置
$('#AmendLineDialogBox').dialog({
autoOpen: true,
modal: true,
closeOnEscape: true,
buttons:
{
'Ok': function () {
// ...snip
$(this).dialog("close");
},
'Cancel': function () {
$(this).dialog("close");
}
},
position: 'center',
title: 'Amendment'
});
1 个解决方案
#1
1
You can do chaining like this:
你可以像这样链接:
$('#AmendLineDialogBox').click(function(e){
e.preventDefault(); //<--------------^-------prevent the default behaviour
}).dialog({
autoOpen: true,
modal: true,
closeOnEscape: true,
buttons:
{
'Ok': function () {
// ...snip
$(this).dialog("close");
},
'Cancel': function () {
$(this).dialog("close");
}
},
position: 'center',
title: 'Amendment'
});
#1
1
You can do chaining like this:
你可以像这样链接:
$('#AmendLineDialogBox').click(function(e){
e.preventDefault(); //<--------------^-------prevent the default behaviour
}).dialog({
autoOpen: true,
modal: true,
closeOnEscape: true,
buttons:
{
'Ok': function () {
// ...snip
$(this).dialog("close");
},
'Cancel': function () {
$(this).dialog("close");
}
},
position: 'center',
title: 'Amendment'
});