Sinneren Sinneren - 1 year ago 90
Javascript Question

How to detect up or down direction jQuery UI datepicker at his input element?

I can detect input offset position at window:
But I must to know where will be my datepicker block(under input or above it) to change it class-name.

Answer Source
beforeShow: function (input, inst) {
    var instHeight = 0;

    setTimeout(function () {
      instHeight = inst.dpDiv.height();
      if(input.getBoundingClientRect().top < instHeight) {
            my: 'left top+5',
            at: 'left bottom',
            collision: 'none',
            of: input
      } else {
            my: 'left bottom-5',
            at: 'left top',
            collision: 'none',
            of: input
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download