Bitwise
Bitwise

Reputation: 8461

Ensure that div is scrolled down on page load

I added pickadate.js to my project and everything is working fine. expect for one strange thing. When the date modal pops up there is some scrollable space at the top. It's kinda hard to describe so hear is a picture:

enter image description here

As you can see there is some empty space at the top there. If I scroll down it fits perfect. So my question is: How can I ensure that the content of this div is scrolled down on page load. Here is what I've currently tried.

$( document ).ready(function() {
  var $input = $('.start-datepicker').pickadate()
  $input.scrollTop = $input.scrollHeight;
});

This doesn't help however. Any help would be great thanks!

Upvotes: 0

Views: 34

Answers (1)

steliosbl
steliosbl

Reputation: 8921

Try:

var d = $('.start-datepicker');
d.scrollTop(d.prop("scrollHeight"));

Upvotes: 1

Related Questions