# Stop Divi offesetting Anchor links

Source:  [Divi Help](https://divi.help/threads/stop-divi-offesetting-anchor-links.2427/) 


```
<script>
jQuery(function($) {
       
    window.et_pb_smooth_scroll = function( $target, $top_section, speed, easing ) {
        var $window_width = $( window ).width();

        $menu_offset = -1;

        if ( $ ('#wpadminbar').length && $window_width > 600 ) {
            $menu_offset += $( '#wpadminbar' ).outerHeight();
        }

        //fix sidenav scroll to top
        if ( $top_section ) {
            $scroll_position = 0;
        } else {
            $scroll_position = $target.offset().top - $menu_offset;
        }

        // set swing (animate's scrollTop default) as default value
        if( typeof easing === 'undefined' ){
            easing = 'swing';
        }

        $( 'html, body' ).animate( { scrollTop :  $scroll_position }, speed, easing );
    }
   
});
</script>
``` 


