After exploration, it has been expanded to add the function of "automatically remembering the position when closed". The source code is as follows:
//myJquery.ui.dialog.ex.js
/////////////////////// /////////////
//Automatically remember the position when jquery.ui.dialog is closed
///////////////// ///////////////////
(function($){
var originClose = $.ui.dialog.prototype.close;
$.ui. dialog.prototype.close = function()
{
//Determine whether the option specifies not to use this function, 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(); //Fix!DOCTYPE BUG
var left = $('body').scrollLeft();
if(left == 0) left = $(document).scrollLeft(); //Fix!DOCTYPE BUG
this.options.position = [this.position.left-left,this.position.top-top];
}
originClose.apply(this,arguments);
};
})(jQuery);
The principle is very simple, no special explanation will be given, friends who have this need can refer to it one time.