title: How to control positioning of jQueryUI datepicker
body: <p>The datepicker in jQueryUI renders with a dynamic position. It renders according to its css if there's enough room for it, but if there isn't enough window space it tries to render on screen. I need it to stay put and render in the same place every time, independent of the screen position or other circumstances. How can this be done with the jQueryUI datepicker? Other implementations of jQuery datepicker seem to have ways of doing this, but I don't see a way of doing it for the UI version. </p>
  
  <p>The answer doesn't seem to be just modifying the css:</p>
  
  <pre><code>.ui-datepicker { width: 17em; padding: .2em .2em 0; (trying top/margin-top/position:relative, etc. here...)}
  </code></pre>
  
  <p>...since when the datepicker is created it dynamically creates top and left in element style. Haven't found a way around this yet. One approach I saw is to give something like this in the beforeShow option:</p>
  
  <pre><code>beforeShow: function(input,inst){
                                  inst.dpDiv.css({ 
                                     'top': input.offsetHeight+ 'px', 
                                     'left':(input.offsetWidth - input.width)+ 'px'
                                                 });
                                  }
  </code></pre>
  
  <p>This has some effect but the top and left properties are still being dynamically set after this is run when the datepicker renders. It's still trying to render on screen. How do I get it to always render in the same spot? My next step is probably to go into the datepicker guts and start pulling things out. Any ideas?</p>
  
  <p>Note that the answer (for the UI version) is not in:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/662220/how-to-change-the-pop-up-position-of-the-jquery-datepicker-control">how-to-change-the-pop-up-position-of-the-jquery-datepicker-control</a></li>
  <li><a href="https://stackoverflow.com/questions/1706839/change-the-position-of-jquery-ui-datepicker">change-the-position-of-jquery-ui-datepicker</a></li>
  </ul>