Jquery. boxy pop-up box (automatically hide/jump next N seconds) _ jquery

Source: Internet
Author: User
I have written some articles before using the Boxy pop-up box (view jquery. (boxy basis). Today, after solving a need, I think it is worthwhile to record it, so I will write another article. The main function is that after the pop-up dialog box, automatically hide every N seconds, and some articles have been written before the use of the Boxy pop-up box (view jquery. (boxy basis). Today, after solving a need, I think it is worthwhile to record it, so I will write another article. The main function is that after the pop-up dialog box, automatically hide every N seconds, and automatically Jump!

Effect:

The encapsulated code is as follows::

The Code is as follows:


// Boxy dialog box Extension
Var Boxy_Extensions = {
Options :{
Title: 'yiba hint ',
CloseText: 'X'
},
// Hide it N seconds after the pop-up
AlertDelayFun: function (info, timer, options ){
Options = $. extend (this. options, options || {});
New Boxy ("

"+ Info +"

", $. Extend ({behaviours: function (){
SetTimeout ('$ (". boxy-wrapper"). hide ();', timer );
}
}, Options ));
},
// Jump automatically after the pop-up
AlertHrefFun: function (info, href, options ){
Options = $. extend (this. options, options || {});
New Boxy ("

"+ Info +"

", $. Extend ({behaviours: function (){
Location. href = href;
}
}, Options ));
}
}


Because the options attribute is public, it is mentioned, and each method has its own options. If you pass options when calling your own method, $. extend will

Merge with the content of the options attribute in the class (overwrite the key value and extend the new key value). It seems that JS writing should also follow the object-oriented principle!

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.