Discuz Two development notes (b)------Jump function application, discuz two development _php tutorial

Source: Internet
Author: User

Discuz Two development notes (b)------Jump function application, discuz two times development


A few days ago in the addition of modification function, suddenly use a hint function, a little do not understand, see his origin after decisive make notes, feel this in the future development must still be used on the. Some places are not very understanding, in the future slowly correct, check.

The JS jump in the HTM page:

$ ("#lyy_real"). Click (function () {

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

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

function (data) {It returns the execution pop-up box and refreshes 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 ':p op.height () + ' px ', ' width ':p op.width () + ' px '});

} else {

Pop.parent (). Append (' + pop.html () + ');

}

var popupobj = $ (' # ' + pop.attr (' id ') + ' _popmenu ');

var left = (Window.innerwidth-popupobj.width ())/2;

var top = (Document.documentelement.clientheight-popupobj.height ())/2;

Popupobj.css ({' Display ': ' block ', ' position ': ' fixed ', ' left ': Left, ' top ': Top, ' z-index ': +, ' opacity ': 1});

$ (' #mask '). CSS ({' Display ': ' Block ', ' width ': ' 100% ', ' height ': ' 100% ', ' position ': ' fixed ', ' top ': ' 0 ', ' Left ': ' 0 ', ' Background ': ' Black ', ' opacity ': ' 0.2 ', ' z-index ': ' 100 '};

POPMENU[POP.ATTR (' id ')] = Pop;

},

Close:function () {

$ (' #mask '). CSS (' Display ', ' none ');

$.each (Popmenu, function (index, obj) {

$ (' # ' + index + ' _popmenu '). CSS (' Display ', ' none ');

});

}

};

Above is the definition of popup, and here are three ways to use it:

Popup.open (' Message to output ', ' Confirm ', ' click on the ' OK ' button to jump to the address '); Confirm is the way to pop up the box, this way there are confirmation and cancellation of the two buttons, click OK before you jump.

Popup.open (' Prompt message ' to output ', ' alert '); alert is the way to pop up the cue box, this way there is only one OK button, if there is a jump link below, do not click will also be in the default time jump page.

Popup.close (); Hide the current form

http://www.bkjia.com/PHPjc/987567.html www.bkjia.com true http://www.bkjia.com/PHPjc/987567.html techarticle Discuz Two development notes (b)------jump function, discuz two times before the development of a few days before the modification function, suddenly use a hint function, a bit do not understand, see his Origin ...

  • Related Article

    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.