Via functions.php
add_action('wp_footer', function() {
if (!defined('ELEMENTOR_VERSION')) {
return;
}
?>
<script>
window.addEventListener('elementor/frontend/init', function() {
elementorFrontend.hooks.addFilter('frontend/handlers/menu_anchor/scroll_top_distance', function(scrollTop) {
return scrollTop - 100; // Ajuste o valor do offset conforme necessário
});
});
</script>
<?php
});
Via JS
<script>
document.addEventListener('DOMContentLoaded', function() {
window.addEventListener('elementor/frontend/init', function() {
elementorFrontend.hooks.addFilter('frontend/handlers/menu_anchor/scroll_top_distance', function(scrollTop) {
var desktopOffset = 110; // Ajuste o valor do offset para desktop
var mobileOffset = 80; // Ajuste o valor do offset para mobile
var isMobile = window.innerWidth <= 767;
return scrollTop - (isMobile ? mobileOffset : desktopOffset);
});
});
});
</script>
<script>
window.addEventListener('elementor/frontend/init', function() {
elementorFrontend.hooks.addFilter('frontend/handlers/menu_anchor/scroll_top_distance', function(scrollTop) {
return scrollTop - 110; // Ajuste o valor do offset conforme necessário
});
});
</script>