Skip to content

Commit

Permalink
Merge pull request #1 from shai126/close-calendar-on-click-outside
Browse files Browse the repository at this point in the history
Fixes Baremetrics#92 (close calend…
  • Loading branch information
shai126 committed Jan 2, 2019
2 parents 3dc81ed + 3bf0c6e commit dae0e23
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 dae0e23

Please sign in to comment.