Created
March 16, 2020 13:27
-
-
Save duroe5698/a7e22425b6d1f40f6f1fa47e9b84282e to your computer and use it in GitHub Desktop.
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
<?php | |
//* Add offset for elementor anchor links with sticky site header | |
add_action( 'wp_footer', function() { | |
if ( ! defined( 'ELEMENTOR_VERSION' ) ) { | |
return; | |
} | |
?> | |
<script> | |
jQuery( function( $ ) { | |
// Add space for Elementor Menu Anchor link | |
$( window ).on( 'elementor/frontend/init', function() { | |
elementorFrontend.hooks.addFilter( 'frontend/handlers/menu_anchor/scroll_top_distance', function( scrollTop ) { | |
return scrollTop - 50; | |
} ); | |
} ); | |
} ); | |
</script> | |
<?php | |
} ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment