Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Scrolling to HTML element
<a href="#" data-go="#node-element" class="go">Go to</a>
<script type="text/javascript">
//We prevent the default scroll
var $this = $(this),
to = $this.attr("data-go"),
topSlider = $(to).position().top;
//We scroll to to the DOM element
$("body, html").animate({
scrollTop : topSlider
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.