Last active
August 29, 2015 14:23
-
-
Save walterdavis/0d5f37b7eb3f5441dfd2 to your computer and use it in GitHub Desktop.
Scroll to position after page load
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
<!-- 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