The author uses jquery in the project. ui. when dialog1.7.2 is used, $ (& quot; # d & quot ;). dialog (& quot; open & quot;);, dialog always pops up the specified position in option; After exploration, it is extended, the "automatically remember the location when it is disabled" function is added. The source code is as follows:
The Code is as follows:
// MyJquery. ui. dialog. ex. js
////////////////////////////////////
// Automatically remember the location when jquery. ui. dialog is disabled
///////////////////////////////////
(Function ($ ){
Var originClose = $. ui. dialog. prototype. close;
$. Ui. dialog. prototype. close = function ()
{
// Determine whether this function is specified in option, such as $ ("# d"). dialog ({rememberPosition: false });
If (this. options. rememberPosition! = False)
{
This. position = this. uiDialog. offset ();
Var top = $ ('body'). scrollTop ();
If (top = 0) top = $ (document). scrollTop (); // corrected! DOCTYPE BUG
Var left = $ ('body'). scrollLeft ();
If (left = 0) left = $ (document). scrollLeft (); // corrected! DOCTYPE BUG
This. options. position = [this. position. left-left, this. position. top-top];
}
OriginClose. apply (this, arguments );
};
}) (JQuery );
The principle is very simple and no special instructions are provided. If you have such requirements, please refer to it.