Skip to content

Instantly share code, notes, and snippets.

@dmassiani
Created April 19, 2013 15:55
Show Gist options
  • Save dmassiani/5421264 to your computer and use it in GitHub Desktop.
Save dmassiani/5421264 to your computer and use it in GitHub Desktop.
Animated Custom Scroll anchor
function scrollToAnchor(aid,v){
var aTag = $(aid);
$('html,body').animate({scrollTop: aTag.offset().top - 60},v);
}
$(document).ready(function(){
$('.subnav').waypoint('sticky');
$('.subnav a').on('click',function(){
scrollToAnchor($(this).attr('href'),300);
return false;
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment