Skip to content

Commit

Permalink
Fixes Baremetrics#92 (close calendar on click outside)
Browse files Browse the repository at this point in the history
  • Loading branch information
shai126 committed Jan 2, 2019
1 parent 3dc81ed commit 3bf0c6e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dev/js/Calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@
// Once you click into a selection.. this lets you click out
this.element.on('click', function() {
document.addEventListener('click', function (event) {
var contains = $(event.target).parents(self.element);
var contains = $(event.target).parent().closest(self.element);

if (!contains.length) {
if (self.presetIsOpen)
Expand Down
2 changes: 1 addition & 1 deletion public/js/Calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@
// Once you click into a selection.. this lets you click out
this.element.on('click', function() {
document.addEventListener('click', function (event) {
var contains = $(event.target).parents(self.element);
var contains = $(event.target).parent().closest(self.element);

if (!contains.length) {
if (self.presetIsOpen)
Expand Down

0 comments on commit 3bf0c6e

Please sign in to comment.