JQuery UI对话框可以记住它在打开和关闭之间的位置 [英] Can JQuery UI Dialog remember its position between opening and closing
问题描述
大小保持不变,但位置不是。
我已经尝试挂入打开事件,但是在我手动重新定位元素后,似乎该位置正被JQuery UI重置。
是否保持对话框的大小可能?我确实认为应该是。
您可以使用jQuery UI对话框beforeclose事件来存储位置和大小。您可以使用选项方法设置位置和大小。
以下是目前适用于我的:
< $ {
$ b $($)$($ {
$(#dialog)对话框({
beforeclose:function .dialog('option','position',[$(this).offset()。left,$(this).offset()。top]);
$(this) ,'width',$(this).width());
$(this).dialog('option','height',$(this).height());
}
});
});
$('#dialog')。对话框('open')
I have a JQuery dialog that I dynamically open and close. Everything is working fine except the position of the dialog is not remembered after it is closed and then reopened.
The size is maintained but the position is not.
I have tried hooking into the 'Open' event but it appears that the position is being reset by JQuery UI after I manually reposition the element.
Is maintaining the size of the dialog possible? I certainly think it should be.
You could use the jQuery UI Dialog "beforeclose" event to store the position and size. You can set both position and size using the "option" method.
Here is what currently works for me:
$(function() {
$("#dialog").dialog({
beforeclose: function(){
$(this).dialog('option', 'position', [$(this).offset().left, $(this).offset().top]);
$(this).dialog('option', 'width', $(this).width());
$(this).dialog('option', 'height', $(this).height());
}
});
});
$('#dialog').dialog('open')
这篇关于JQuery UI对话框可以记住它在打开和关闭之间的位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!