medium-style-confirm
Usage
mscConfirm(title, okCallback)
:
mscConfirm("Delete?",function(){
alert("Post deleted");
});
mscConfirm(title, subheading, okCallback)
:
mscConfirm("Delete", "Are you sure you want to delete this post?", function(){
alert("Post deleted");
});
mscConfirm(title, subheading, okCallback, cancelCallback)
:
mscConfirm("Delete", "Are you sure you want to delete this post?", function(){
alert("Post deleted");
},
function() {
alert('Cancelled');
});
mscConfirm({
title: 'License',
subtitle: 'Do you accept the licese agreement?',
okText: 'I Agree',
cancelText: 'I Dont',
dismissOverlay: true,
onOk: function() {
alert('Awesome.');
},
onCancel: function() {
alert('Sad face :( .');
}
});
New
Prompt -> Equivalent of JS prompt()
The API for mscPrompt
and mscConfirm
is same. Just the onOk
callback of prompt receives a value
parameter entered into the prompt.
mscPrompt({
title: 'Subscribe',
subtitle: 'Enter your email to subscribe to the newsletter.',
defaultValue: 'email',
okText: 'Subscribe',
cancelText: 'Cancel',
dismissOverlay: true,
placeholder: 'Enter your email',
onOk: function(value) {
mscAlert(value+ " has been subscribed to the newsletter.");
},
onCancel: function() {
mscAlert('Sad face :( .');
}
});
Alert -> Equivalent of JS alert()
mscAlert("Hello World.");
Added support for new lines and carriage return in mscAlert()
mscAlert({
title: 'Done',
subtitle: 'You have been registered successfully. \n Your reg. ID is 4321',
okText: 'Close',
});
Installation
- Install via bower
bower install medium-style-confirm
or download msc-style.css and msc-script.js. - Include
msc-style.css
in html as <link rel="stylesheet" href="msc-style.css">
just before ending head
tag. - Include
msc-script.js
in html as <script src="msc-script.js">
just before ending body
tag. - Call the
mscConfirm()
function as shown above.
LICENSE
MIT