Skip to content
This repository was archived by the owner on Oct 22, 2025. It is now read-only.

Commit 391f692

Browse files
committed
added option to dismiss dialog when clicked on overlay
1 parent 002399e commit 391f692

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "medium-style-confirm",
3-
"version": "0.4.0",
3+
"version": "0.4.1",
44
"homepage": "http://bitwiser.i/medium-style-confirm/",
55
"authors": [
66
"Brijesh Bittu <brijeshb42@gmail.com>"

js/msc-script.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@
2525
onCancel: null,
2626
okText: 'OK',
2727
cancelText: 'Cancel',
28-
placeholder: 'Enter value'
28+
placeholder: 'Enter value',
29+
dismissOverlay: false
2930
};
3031

3132
if(typeof title === 'object') {
@@ -55,6 +56,10 @@
5556
closeBtn.innerHTML = '&times;';
5657
overlay.appendChild(closeBtn);
5758

59+
if(options.dismissOverlay) {
60+
overlay.addEventListener("click", destroy);
61+
}
62+
5863
closeBtn.addEventListener('click', destroy);
5964

6065
var content = ce('div', 'msc-content'),
@@ -104,6 +109,9 @@
104109
closeBtn.removeEventListener('click', destroy);
105110
okBtn.removeEventListener('click', ok);
106111
cancelbtn.removeEventListener('click', cancel);
112+
if(options.dismissOverlay) {
113+
overlay.removeEventListener("click", destroy);
114+
}
107115
document.removeEventListener('keyup', _hide);
108116
document.body.removeChild(dialog);
109117
}

0 commit comments

Comments
 (0)