Skip to content

Commit 8f669cd

Browse files
v1.08 release; quick fixes
1 parent 90b78ff commit 8f669cd

File tree

6 files changed

+30
-25
lines changed

6 files changed

+30
-25
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
# jQuery Quick Modal
22

3+
#### v1.08 | October 5, 2015
4+
* Fixed an issue where the close modal bindings still persisted when a specific combination of actions were taken
5+
6+
---
7+
38
#### v1.07 | October 5, 2015
49
* Added the **onOpen** and **onClose** options
510
* Fixed an issue where the close modal bindings persisted after unbinding
611
* Code cleanup for maintainability
712

8-
--
13+
---
914

1015
#### v1.06 | September 30, 2015
1116
* Added the **appendBackgroundTo** option

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jquery-quick-modal",
3-
"version": "1.07",
3+
"version": "1.08",
44
"homepage": "https://github.com/kevinberonilla/jquery-quick-modal",
55
"authors": [
66
"Kevin Beronilla <kevin.beronilla@gmail.com>"

css/quick-modal.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* --------------------------------------------------
2-
jQuery Quick Modal v1.07
2+
jQuery Quick Modal v1.08
33
44
By Kevin Beronilla
55
http://www.kevinberonilla.com

css/quick-modal.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/jquery.quick-modal.js

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* --------------------------------------------------
2-
jQuery Quick Modal v1.07
2+
jQuery Quick Modal v1.08
33
44
By Kevin Beronilla
55
http://www.kevinberonilla.com
@@ -65,10 +65,14 @@ http://www.opensource.org/licenses/mit-license.php
6565
self = this;
6666

6767
function keyUpCheck(e) {
68-
if (e.keyCode == 27 && modal.is(':visible') && settings.enableEsc) { // Esc key events based on options
69-
self.quickModal('close', settings);
70-
bodyTag.unbind('keyup', keyUpCheck); // Unbind to prevent multiple bindings
71-
}
68+
if (e.keyCode == 27 && modal.is(':visible') && settings.enableEsc) closeModal(); // Esc key events based on options
69+
}
70+
71+
function closeModal() {
72+
self.quickModal('close', settings);
73+
bodyTag.unbind('keyup', keyUpCheck);
74+
closeModalLink.unbind('click');
75+
$('#modal-background').unbind('click');
7276
}
7377

7478
if (!$('#modal-background').length) $(settings.appendBackgroundTo).append('<div id="modal-background"></div>'); // Append background; do not append if background already exists
@@ -85,28 +89,21 @@ http://www.opensource.org/licenses/mit-license.php
8589
modal.hide(); // Hide any currently visible modals
8690
self.show();
8791
bodyTag.keyup(keyUpCheck);
88-
$('#modal-background').show()
89-
.unbind('click'); // Unbind previously bound events to remove lingering settings
92+
$('#modal-background').show();
9093

9194
setTimeout(function() { // Ensure elements are displayed before adding classes
95+
settings.onOpen.call(); // Open callback
9296
$('#modal-background').addClass('visible');
9397
self.addClass('visible');
94-
settings.onOpen.call(); // Open callback
9598
self.trigger('modalopen'); // Trigger custom 'open' event
99+
if (settings.enableClickAway) $('#modal-background').click(closeModal);
96100
}, 25);
97101

98-
closeModalLink.unbind('click') // Unbind previously bound events to remove lingering settings
99-
.click(function(e) { // Bind events based on options
100-
e.preventDefault();
101-
self.quickModal('close', settings);
102-
});
102+
closeModalLink.click(function(e) { // Bind events based on options
103+
e.preventDefault();
104+
closeModal();
105+
});
103106

104-
if (settings.enableClickAway) {
105-
$('#modal-background').click(function() {
106-
self.quickModal('close', settings);
107-
bodyTag.unbind('keyup', keyUpCheck); // Unbind to prevent multiple bindings
108-
});
109-
}
110107
break;
111108

112109
case 'close':
@@ -120,13 +117,15 @@ http://www.opensource.org/licenses/mit-license.php
120117
self.hide();
121118
self.trigger('modalclose'); // Trigger custom 'close' event
122119
}, settings.speed);
120+
123121
break;
124122

125123
case 'trigger':
126124
var modalId = self.data('modal-id'),
127125
targetModal = $('#' + modalId);
128126

129127
targetModal.quickModal('open', settings);
128+
130129
break;
131130

132131
default:
@@ -145,6 +144,7 @@ http://www.opensource.org/licenses/mit-license.php
145144
else targetModal.quickModal('open', args);
146145
});
147146
}
147+
148148
return this; // Return the object to enable chaining
149149
}
150150
}(jQuery));

js/jquery.quick-modal.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)