Home > Web Front-end > JS Tutorial > Add the function of 'automatically remembering the position when closed' to jquery.ui.dialog_jquery

Add the function of 'automatically remembering the position when closed' to jquery.ui.dialog_jquery

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-05-16 18:41:10
Original
1108 people have browsed it

After exploration, it has been expanded to add the function of "automatically remembering the position when closed". The source code is as follows:

Copy code The 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.
Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
html - element ui dialog box nesting
From 1970-01-01 08:00:00
0
0
0
Disable continuous animation of v-dialog
From 1970-01-01 08:00:00
0
0
0
Why does the dialog box not pop up?
From 1970-01-01 08:00:00
0
0
0
javascript - Unable to get value of dialog
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template