Skip to content

Instantly share code, notes, and snippets.

@chriswagoner
Created September 26, 2018 19:34
Show Gist options
  • Save chriswagoner/a6bea12851d39e7bb5170f7c18b417f4 to your computer and use it in GitHub Desktop.
Save chriswagoner/a6bea12851d39e7bb5170f7c18b417f4 to your computer and use it in GitHub Desktop.
Offsetting the Beaver Builder page scroll for anchor links
jQuery(function ($) {
var win = $(window);
function bbScroll() {
if ('undefined' != typeof FLBuilderLayoutConfig) {
var offset = 0;
if ('undefined' === typeof FLBuilderLayout) {
return;
}
if (FLBuilderLayout._isMobile() && win.width() < 992) {
offset = 0;
}
if ($('body.admin-bar').length > 0) {
offset += 32;
}
FLBuilderLayoutConfig.anchorLinkAnimations.duration = 1000;
FLBuilderLayoutConfig.anchorLinkAnimations.easing = 'swing';
FLBuilderLayoutConfig.anchorLinkAnimations.offset = offset;
}
}
bbScroll();
win.on('resize', bbScroll);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment