Skip to content

Instantly share code, notes, and snippets.

@davidecavaliere
Forked from ryanschuhler/animate-scroll.js
Created August 17, 2013 08:40
Show Gist options
  • Save davidecavaliere/6255948 to your computer and use it in GitHub Desktop.
Save davidecavaliere/6255948 to your computer and use it in GitHub Desktop.
AUI().use(
'anim',
function(A) {
A.all('.animate-scroll').on(
'click',
function(event) {
event.preventDefault();
var section = A.one(event.currentTarget.get('hash'));
var scrollTo = section.get('offsetTop');
new A.Anim(
{
duration: 0.5,
easing: 'easeBoth',
node: 'win',
to: {
scroll: [0, scrollTo]
}
}
).run();
}
);
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment