frankyonnetti
5/25/2016 - 8:32 PM

#jquery #js Scroll to postion to clicked anchor from previous page

jQuery - scroll to postion to clicked anchor from previous page #jquery

// Wait for the content to load.
$(window).load(function () {

  // Scroll to the position below header.
  if ($('body#about').length) {
    var aboutSectionURL = window.location.hash // Use hash# ID
    var scrollToAboutSection = $(aboutSectionURL).offset().top - 115
    $('html, body').animate({
      scrollTop: scrollToAboutSection
    }, 'slow')
  }
})