-
-
Save msaari/b6e5a3100163e823380498b9aedfc49e to your computer and use it in GitHub Desktop.
Scrolling
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 this to your theme functions.php: | |
add_action( 'wp_footer', function() { | |
?> | |
<script> | |
jQuery(document).ready(function($) { | |
var offset = $('mark').first().offset().top // use this line if you use <mark> tags | |
var offset = $('.classname').first().offset().top // use this line and change "classname" if you use a CSS class | |
$("html, body").animate({ scrollTop: offset }, 100); | |
}) | |
</script> | |
<?php | |
} ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment