Discuz secondary development note (2) ------ jump function application, discuz secondary development _ PHP Tutorial

Source: Internet
Author: User
Discuz secondary development note (2) ------ jump function application, secondary development of discuz. Discuz secondary development note (II) ------ jump function application: a prompt function is suddenly used when the change function is added a few days before the second development of discuz, view his origins: Secondary development notes of discuz (II) ------ jump function application, secondary development of discuz

When I added the modification feature a few days ago, I suddenly used a prompt function, which was a bit incomprehensible. I took a note after reading his history, I feel that this will definitely be used in future development. In some cases, you may not understand it very well.

Js jump used on the Htm page:

$ ("# Lyy_real"). click (function (){

$. Post ("api/realnamechange. php ",

{Uname: $ ("# uname "). val (), uid: $ ("# uid "). val (), realname: $ ("# realname_lyy "). val ()},

Function (data) {data return execution dialog box, and refresh the current page.

Popup. open (data, 'Confirm', 'Home. php? Mod = space & uid = '+ $ ("# uid"). val ());

}

);

})

Common. js

Var POPMENU = new Object;

Var popup = {

Init: function (){

Var $ this = this;

$ ('. Popup'). each (function (index, obj ){

Obj = $ (obj );

Var pop = $ (obj. attr ('href '));

If (pop & pop. attr ('popup ')){

Pop.css ({'display': 'none '});

Obj. on ('click', function (e ){

$ This. open (pop );

});

}

});

This. maskinit ();

},

Maskinit: function (){

Var $ this = this;

$ ('# Mask'). off (). on ('tap', function (){

$ This. close ();

});

},

Open: function (pop, type, url ){

This. close ();

This. maskinit ();

If (typeof pop = 'string '){

$ ('# Ntcmsg'). remove ();

If (type = 'alert '){

Pop ='

'+ Pop +'

'

} Else if (type = 'confirm '){

Pop ='

'+ Pop +'
Cancel

'

}

$ ('Body'). append ('

'+ Pop +'

');

Pop = $ ('# ntcmsg ');

}

If (POPMENU [pop. attr ('id')]) {

$ ('#' + Pop. attr ('id') + '_popmenu'{.html(pop.html({}.css ({'height': pop. height () + 'px ', 'width': pop. width () + 'px '});

} Else {

Pop. parent (). append ('

'+ Pop.html () +'

');

}

Var popupobj = $ ('#' + pop. attr ('id') + '_ popmenu ');

Var left = (window. innerWidth-popupobj. width ()/2;

Var top = (document.doc umentElement. clientHeight-popupobj. height ()/2;

Popupobj.css ({'display': 'block', 'position': 'fixed', 'left': left, 'top': top, 'Z-Index': 120, 'Opacity ': 1 });

Detail ('privacy mask' detail .css ({'display': 'block', 'width': '000000', 'height': '000000', 'position': 'fixed', 'top ': '0', 'left': '0', 'background': 'black', 'Opacity ': '0. 2 ', 'Z-Index': '20140901 '});

POPMENU [pop. attr ('id')] = pop;

},

Close: function (){

Certificate ('audio mask'audio .css ('display', 'none ');

$. Each (POPMENU, function (index, obj ){

$ ('#' + Index + '_popmenu'mirror.css ('display', 'none ');

});

}

};

The above is the definition of popup. below are three of its usage:

Popup. open ('prompt information to output', 'Confirm', and 'Address to jump after clicking OK '); confirm is the pop-up prompt box, you can click OK to confirm or cancel the operation.

Popup. open ('prompt information to output', 'Alert '); alert is the method in which a prompt box is displayed. in this way, there is only one OK button. if there is a jump link below, if you do not click it, the page will be displayed by default.

Popup. close (); hide the current form

Break (2) ------ jump function application. when the change function was added in the second development of discuz a few days ago, a prompt function was suddenly used. I did not understand it and read about its origins...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.