From d2643ce6c25e60f3162305b8bc9d5b11a104d0f9 Mon Sep 17 00:00:00 2001 From: Luckas5 Date: Tue, 24 Mar 2015 13:13:28 +0100 Subject: [PATCH] Added close on Tab behaviour (Focusout) When you press tab, popups hides . Added focusout support --- js/bootstrap-timepicker.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/js/bootstrap-timepicker.js b/js/bootstrap-timepicker.js index c8208bbf..9baf224e 100644 --- a/js/bootstrap-timepicker.js +++ b/js/bootstrap-timepicker.js @@ -48,6 +48,7 @@ 'click.timepicker': $.proxy(this.highlightUnit, this), 'keydown.timepicker': $.proxy(this.elementKeydown, this), 'blur.timepicker': $.proxy(this.blurElement, this), + 'focusout.timepicker': $.proxy(this.focusout, this), 'mousewheel.timepicker DOMMouseScroll.timepicker': $.proxy(this.mousewheel, this) }); } else { @@ -56,6 +57,7 @@ 'focus.timepicker': $.proxy(this.showWidget, this), 'click.timepicker': $.proxy(this.showWidget, this), 'blur.timepicker': $.proxy(this.blurElement, this), + 'focusout.timepicker': $.proxy(this.focusout, this), 'mousewheel.timepicker DOMMouseScroll.timepicker': $.proxy(this.mousewheel, this) }); } else { @@ -64,6 +66,7 @@ 'click.timepicker': $.proxy(this.highlightUnit, this), 'keydown.timepicker': $.proxy(this.elementKeydown, this), 'blur.timepicker': $.proxy(this.blurElement, this), + 'focusout.timepicker': $.proxy(this.focusout, this), 'mousewheel.timepicker DOMMouseScroll.timepicker': $.proxy(this.mousewheel, this) }); } @@ -92,6 +95,10 @@ this.highlightedUnit = null; this.updateFromElementVal(); }, + + focusout: function () { + this.hideWidget(); + }, clear: function() { this.hour = '';