Skip to content

Commit

Permalink
fix #45
Browse files Browse the repository at this point in the history
  • Loading branch information
longbill committed Jun 25, 2015
1 parent 9ec2a28 commit ab7bb0d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions jquery.daterangepicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -434,16 +434,23 @@
var initiated = false;
var self = this;
var selfDom = $(self).get(0);
var domChangeTimer;

$(this).unbind('.datepicker').bind('click.datepicker',function(evt)
{
var isOpen = box.is(':visible');
$(document).trigger('click.datepicker');
evt.stopPropagation();
if(!isOpen) open(opt.duration);
}).bind('change.datepicker', function(evt)
{
checkAndSetDefaultValue();
}).bind('keyup.datepicker',function()
{
try{ clearTimeout(domChangeTimer); }catch(e){}
domChangeTimer = setTimeout(function()
{
checkAndSetDefaultValue();
},2000);
});

init_datepicker.call(this);
Expand Down Expand Up @@ -585,7 +592,8 @@
evt.stopPropagation();
});

$(document).bind('click.datepicker',function()
//if user click other place of the webpage, close date range picker window
$(document).bind('click.datepicker',function(evt)
{
if (box.is(':visible')) closeDatePicker();
});
Expand Down

0 comments on commit ab7bb0d

Please sign in to comment.