Blog

Auto scroll to element with specific ID on page load

Posted on: 20 June 2018     Posted by: Freesize Workroom
$(window).load(function(){
  jumpOnload();
});

function jumpOnload(){
  if (window.location.hash != '') {
      var target = window.location.hash;
      $(target).click();

      if (target.length) {
        $('html, body').animate({
          scrollTop: ($(target).offset().top - 85)
        }, 1000);
      }
    }
}

Leave a Reply

Your email address will not be published.