Created
September 26, 2018 19:34
-
-
Save chriswagoner/a6bea12851d39e7bb5170f7c18b417f4 to your computer and use it in GitHub Desktop.
Offsetting the Beaver Builder page scroll for anchor links
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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