longbill / jquery-date-range-picker

A jQuery plugin that allows user to select a date range
MIT License
1.12k stars 579 forks source link

Implement customizable/auto datepicker positioning #33

Open daolm opened 10 years ago

daolm commented 10 years ago

Hi, I want to set datepicker show on top of input instead bottom. But I see no option to choose. Can you tell me how can I set position for datepicker?

Thank you!

boogiebug commented 8 years ago

Following snippet may help:

$('#daterange').dateRangePicker({
      // date range picker options
    })
    .bind('datepicker-open', function() {
      // adjust position
      var elem = $('#daterange');
      $('.date-picker-wrapper').css({
        position: 'absolute',
        top: '' + (elem.offset().top - 245) + 'px',
        left: '' + elem.offset().left + 'px'
      });
    })
anupalhub commented 8 years ago

@boogiebug Thanks :)

bs-thomas commented 7 years ago

@boogiebug This doesn't seem to work anymore for some reason. I tried setting top left bottom and right. Only bottom and right worked. The rest stayed the same and had no effect at all.

ricco24 commented 7 years ago

Try to change bind('datepicker-open') to bind('datepicker-opened')

jmichaelterenin commented 5 years ago

Is there any chance this gets revisited? bind('datepicker-opened') makes for a very undesired effect of flashing the display in one spot, and then completing the display in the desired position.