The author uses jquery in the project. ui. when dialog 1.7.2 is used, $ ("# d") is used "). dialog ("open");, dialog always pops up the position specified in option;
After expansion, the function of "automatically remembering the location when the feature is disabled" is added. The source code is as follows:
Copy to ClipboardReference: [www.bkjia.com] // 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.