Skip to content

Instantly share code, notes, and snippets.

@carlosonweb
Created October 2, 2018 00:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carlosonweb/f3444827fd768ace0f82b7494577b91d to your computer and use it in GitHub Desktop.
Save carlosonweb/f3444827fd768ace0f82b7494577b91d to your computer and use it in GitHub Desktop.
Beaver Builder Smooth Scrolling From Another Page
/**
*
* Smooth Scrolling from another page.
* To be paired with this code:
* https://kb.wpbeaverbuilder.com/article/634-smooth-scrolling-tweaks-with-code
*
*/
jQuery(document).ready(function($) {
var hashLink = $(window.location.hash),
offsetSize = $("header").innerHeight() + 40;
if ( hashLink.length ) {
$("html, body").animate({
scrollTop: hashLink.offset().top - offsetSize
}, 500);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment