Jquery plug-in jquery. confirm pop-up confirmation message,
This article introduces the implementation method of the plug-in jquery. confirm pop-up confirmation message, which has some reference value. We will share it with you for your reference. The specific content is as follows:
Effect:
Code:
1. Default plug-in Parameters
// Default parameter $. confirm. defaults = {// style css: "http://static.qianduanblog.com/css/jquery.confirm/default.min.css? V = "+ Math. ceil (new Date ()/86400000), // the content of the confirmation box content:" OK? ", // Confirmation button text sureButton:" OK ", // cancel button text cancelButton:" cancel ", // position :{}, // autoOpen: false automatically opens, // animation duration: 123, // enable confirmation box callback onopen: emptyFn, // click confirm or cancel the callback onclick: emptyFn, // confirm the callback onsure: emptyFn, // cancel the callback oncancel: emptyFn, // close the confirmation box and callback onclose: emptyFn}
2. Plug-in structure and style
The dom structure of jquery. confirm is as follows:
<Div class = "jquery_confirm ____" style = "display: none "> <div class =" jquery_confirm ____ body "> confirmation box message </div> <div class =" jquery_confirm ____ footer "> <button class =" button-primary jquery_confirm ____ sure "> OK </button> <button class =" button-error jquery_confirm ____ cancel "> cancel </button> </div>
The default plug-in style is based on css.3. The default plug-in style address is default. The plug-in style is only rendered once and will not be rendered multiple times. The first time you use the plug-in style is used as the standard.
3. Usage
// Open the confirmation box $. confirm ({content: "Are you sure you want to view it? ", Onopen: function () {alert (" confirmation box opened! ") ;}, Onclose: function () {alert (" the confirmation box is closed! ") ;}, Onsure: function () {alert (" You clicked the OK button! ") ;}, Oncancel: function () {alert (" You have clicked the cancel button! ") ;}, Onclick: function (s) {if (s) {alert (" You clicked the OK button! ");} Else {alert (" You have clicked the cancel button! ") ;}}); $. Confirm (" OK? ", Function (s) {if (s) {alert (" You clicked the OK button! ");} Else {alert (" You have clicked the cancel button! ");}});
I hope this article will help you learn jquery programming.
Articles you may be interested in:
- JQuery-based pop-up message plug-in DivAlert Tour (1)
- The message box is displayed in the lower right corner of the message plug-in based on jQuery.
- Use JQuery to create QQ pop-up messages conforming to Web standards
- How does jquery determine the pop-up message when the browser returns?
- Jquery creates a nice pop-up layer prompting message Effects