Skip to content

Instantly share code, notes, and snippets.

@walterdavis
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save walterdavis/0d5f37b7eb3f5441dfd2 to your computer and use it in GitHub Desktop.
Save walterdavis/0d5f37b7eb3f5441dfd2 to your computer and use it in GitHub Desktop.
Scroll to position after page load
<!-- add these lines to the HEAD of the page — before </head> -->
<script src="http://ajax.googleapis.com/ajax/libs/prototype/1.7/prototype.js" type="text/javascript" charset="utf-8"></script>
<script src="http://ajax.googleapis.com/ajax/libs/scriptaculous/1.9/scriptaculous.js?load=effects" type="text/javascript"></script>
<!-- add these lines to the very end of the BODY of the page — before </body> -->
<script type="text/javascript">
if(window.location.search){
var target = window.location.search.split('?').last();
if(target && $(target)){
Effect.ScrollTo(target, {offset: 200, duration: 0.4});
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment