An elegant mask pop-up Layer dialog box based on the jquery appearance

Source: Internet
Author: User

Today we are going to share a jquery-based pop-up dialog plugin that contains various types of dialog boxes, such as prompt boxes, confirmation boxes, and so on. More practical is that the button event in this jquery dialog can also be captured by us, making it easy to use the various events of the dialog box button.

Online preview Source Download

The implemented code.

HTML code:

 <Centerclass= "Demo">    <Buttononclick= "payment ();">Payment Tips Layer</Button>    <Buttononclick= "Confirm ();">Confirmation Box prompt Layer</Button>    <Buttononclick= "Alert ();">Alert Cue Layer</Button>    <Buttonclass= "Delorder"item_id= "123">Delete a product tip layer</Button>    </Center>

JS Code:

  //whether payment is complete        functionpayment () {Qikoo.dialog.payNotice (function() {alert ("Completed payment button");//tips for completing a paid payment},function() {alert ("You ordered the bill to meet the problem button");//tips for payment problems},function() {alert ("You clicked the Close button");//Tips for closing buttons            }); }        functionConfirm () {qikoo.dialog.confirm (' Are you sure you want to delete this item? ‘,function() {alert ("Delete it!" "); }, function() {alert ("Cancel it!" ");        }); }        functionAlert () {Qikoo.dialog.alert ("Webmaster Material-sc.chinaz.com"); } $ (document). Ready (function () {            $(". Delorder"). Click (function(e) {_this=$ (e.target);            Tips.carttip (_this);            }); varTips ={carttip:function(_this) {varTPL = [          ' <div class= ' dialog-delorder ' > ',            ' <div class= ' dialog-bar ' > ',              ' Warm tips ',              ' <a href= ' # "onclick=" return false; "class=" Dialog-close "title=" Close "></a>",            ' </div> ',            ' <div class= ' dialog-content ' > ',              ' <p> OK to remove this item from the shopping cart? </p> ',            ' </div> ',            ' <div class= ' dialog-console ' > ',              ' <a class= ' console-btn-confirm ' href= ' # ' onclick= ' return false; ' title= ' OK > OK </a> ',              ' <a class= ' console-btn-cancel ' href= ' # ' onclick= ' return false; ' title= ' Cancel > Cancel </a> ',            ' </div> ',          ' </div> '].join (‘‘); varDialogele = $ (TPL). AppendTo (' body '); varMainele = Dialogele.filter ('. Dialog-delorder ')); vartop = _this.offset (). Top + 20; varleft =_this.offset (). Left; Mainele.css (' Top ', top); Mainele.css (' Left ', left); Dialogele.filter ('. Dialog-bg '). CSS (' height '), $ (document). Height ()); Dialogele.find (' A.console-btn-confirm '). Click (function() {Tips.wartip ("id" + _this.attr ("item_id") + "the product has been deleted!" "); $(". Dialog-delorder"). Remove ();                    }); Dialogele.find (' A.console-btn-cancel,a.dialog-close '). Click (function () {                        $(". Dialog-delorder"). Remove ();                }); }, Wartip:function(TXT) {varTPL = [          ' <div class= ' Dialog-war ' > ',            ' <div class= ' dialog-bar ' > ',              Prompted,              ' <a href= ' # "onclick=" return false; "class=" Dialog-close "title=" Close "></a>",            ' </div> ',            ' <div class= ' dialog-content ' > ',              ' <p> ' + txt + ' </p> ',              ' <div class= ' dialog-console ' > ',                ' <a class= ' console-btn-confirm ' href= ' # ' onclick= ' return false; ' title= ' OK > OK </a> ',              ' </div> ',            ' </div> ',          ' </div> '].join (‘‘); varDialogele = $ (TPL). AppendTo (' body '); varMainele = Dialogele.filter ('. Dialog-war ')); varleft = ($ (window). Width ()-mainele.width ())/2; Mainele.css (' Left ', left); Mainele.css (' Top ', ' 200px '); Dialogele.filter ('. Dialog-bg '). CSS (' height '), $ (document). Height ()); Dialogele.find (' A.dialog-close,a.console-btn-confirm '). Click (function () {                        $(". Dialog-war"). Remove ();                });        }            }; });

via:http://www.w2bc.com/article/25539

An elegant mask pop-up Layer dialog box based on the jquery appearance

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.