add_action( 'wp_footer', function () { ?> <script> (function($){ $(document).on('ready', function(){ $('.sp-ea-single>.ea-header a').on('click', function(e){ e.preventDefault; var $this = $(this); setTimeout(function(){ var targetTop = $this.offset().top - 150 + 'px'; $("html, body").animate({ scrollTop: targetTop }, "slow"); }, 500); }); }); })(jQuery); </script> <?php },99 );
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter