Last active
May 14, 2024 16:15
-
-
Save softiconic/3cbf2cd9687f3c59bd5eeaa48e98e067 to your computer and use it in GitHub Desktop.
Adjust the positioning offset of the Elementor anchor element/links
This file contains hidden or 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
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 - 120; | |
} ); | |
} ); | |
} ); | |
</script> | |
<?php | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment