Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@lukehedger
Created December 17, 2013 15:01
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 lukehedger/8006235 to your computer and use it in GitHub Desktop.
Save lukehedger/8006235 to your computer and use it in GitHub Desktop.
Animated ScrollTo element
_addListeners: ->
$(document).on 'click', '.scrollTo', @_onScrollToClick
# where <a id="#element"> corresponds to <div id="element">
_onScrollToClick: ->
id = $(this).attr 'id'
$('html,body').animate {scrollTop: $(id).offset().top},400
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment