Skip to content

Commit

Permalink
Move picker when window resized
Browse files Browse the repository at this point in the history
  • Loading branch information
dangrossman committed Oct 17, 2015
1 parent 5f7d061 commit 4afcfca
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions daterangepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -1041,6 +1041,7 @@

// Create a click proxy that is private to this instance of datepicker, for unbinding
this._outsideClickProxy = $.proxy(function(e) { this.outsideClick(e); }, this);

// Bind global datepicker mousedown for hiding and
$(document)
.on('mousedown.daterangepicker', this._outsideClickProxy)
Expand All @@ -1051,6 +1052,9 @@
// and also close when focus changes to outside the picker (eg. tabbing between controls)
.on('focusin.daterangepicker', this._outsideClickProxy);

// Reposition the picker if the window is resized while it's open
$(window).on('resize.daterangepicker', $.proxy(function(e) { this.move(e); }, this));

this.oldStartDate = this.startDate.clone();
this.oldEndDate = this.endDate.clone();

Expand Down Expand Up @@ -1078,6 +1082,7 @@
this.updateElement();

$(document).off('.daterangepicker');
$(window).off('.daterangepicker');
this.container.hide();
this.element.trigger('hide.daterangepicker', this);
this.isShowing = false;
Expand Down

0 comments on commit 4afcfca

Please sign in to comment.