Skip to content

Commit

Permalink
remove hide eventHandler on hide
Browse files Browse the repository at this point in the history
  • Loading branch information
jdewit committed Jan 30, 2013
1 parent 32e125d commit f07b393
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
15 changes: 9 additions & 6 deletions js/bootstrap-timepicker.js
Expand Up @@ -317,7 +317,11 @@
return this.formatTime(this.hour, this.minute, this.second, this.meridian);
},

hideWidget: function(){
hideWidget: function() {
if (this.isOpen === false) {
return;
}

this.$element.trigger({
'type': 'hide.timepicker',
'time': this.getTime()
Expand All @@ -329,6 +333,8 @@
this.$widget.removeClass('open');
}

$(document).off('mousedown.timepicker');

this.isOpen = false;
},

Expand Down Expand Up @@ -567,16 +573,13 @@
this.update();
},

showWidget: function(e) {
e.stopPropagation();
e.preventDefault();

showWidget: function() {
if (this.isOpen) {
return;
}

var self = this;
$(document).one('mousedown.timepicker', function (e) {
$(document).on('mousedown.timepicker', function (e) {
// Clicked outside the timepicker, hide it
if ($(e.target).closest('.bootstrap-timepicker-widget').length === 0) {
self.hideWidget();
Expand Down

0 comments on commit f07b393

Please sign in to comment.