medium-style-confirm
All three: mscAlert,mscPrompt and mscConfirm support similar APIs as shown for mscConfirm
mscConfirm
mscConfirm(title, okCallback)
mscConfirm("Delete?",function(){
alert("Post deleted");
});
mscConfirm(title, subtitle, okCallback)
mscConfirm("Delete", "Are you sure you want to delete this post?", function(){
alert("Post deleted");
});
mscConfirm(title, subtitle, okCallback, cancelCallback)
mscConfirm("Delete", "Are you sure you want to delete this post?", function(){
alert("Post deleted");
},
function() {
alert('Cancelled');
});
mscConfirm(object)
mscConfirm({
title: 'License',
subtitle: 'Do you accept the licese agreement?', // default: ''
okText: 'I Agree', // default: OK
cancelText: 'I Dont', // default: Cancel,
dismissOverlay: true, // default: false, closes dialog box when clicked on overlay.
onOk: function() {
alert('Awesome.');
},
onCancel: function() {
alert('Sad face :( .');
}
});
mscPrompt
mscPrompt(object)
mscPrompt({
title: 'Subscribe',
subtitle: 'Enter your email to subscribe to the newsletter', // default: ''
okText: 'Subscribe', // default: OK
cancelText: 'Cancel', // default: Cancel,
placeholder: 'Your email here', // default: empty, placeholder for input text box
onOk: function(val) {
mscAlert("Your email: "+val+" has subscribed to the newsletter.");
},
onCancel: function() {
mscAlert(":( You cancelled on me.");
}
});
mscAlert
mscAlert(title)
mscAlert("Hello World");
mscAlert(object)
mscAlert({
title: 'Done',
subtitle: 'You have subscribed to the mailing list.', // default: ''
okText: 'Close', // default: OK
});
mscAlert(object)
mscAlert({
title: 'Done',
subtitle: 'You have been registered successfully. \n Your reg. ID is 4321', // default: ''
okText: 'Close', // default: OK
});
All three: mscAlert,mscPrompt and mscConfirm support similar APIs as shown for mscConfirm
Usage
- Install via bower:
bower install medium-style-confirm.
- OR
- Download msc-style.css and msc-script.js.
- Include
msc-style.cssin html as<link rel="stylesheet" href="msc-style.css">
just before endingheadtag. - Include
msc-script.jsin html as<script src="msc-script.js">
just before endingbodytag. - Call the code
mscConfirm(), mscAlert() or mscPrompt()function as shown in demo.