Skip to content

Instantly share code, notes, and snippets.

@walterdavis
Last active Aug 29, 2015
Embed
What would you like to do?
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