Skip to content

Instantly share code, notes, and snippets.

@cliffparnitzky
Last active December 14, 2015 16:39
Show Gist options
  • Save cliffparnitzky/5117018 to your computer and use it in GitHub Desktop.
Save cliffparnitzky/5117018 to your computer and use it in GitHub Desktop.
Automatically scroll to a defined element after loading a page.
<script type="text/javascript">
$(document).ready(function() {
var targetOffset = $('#main').offset().top;
$('html,body').delay(1000).animate({scrollTop: targetOffset}, 1000);
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment