Skip to content

Instantly share code, notes, and snippets.

View valentin9's full-sized avatar

Valentin Derksen valentin9

  • GetYourGuide
  • Zürich, Switzerland
  • 01:51 (UTC +01:00)
View GitHub Profile
@joshbeckman
joshbeckman / animatedScrollTo.js
Created September 30, 2013 14:51
ScrollTo animation using pure javascript and no jquery
document.getElementsByTagName('button')[0].onclick = function () {
scrollTo(document.body, 0, 1250);
}
function scrollTo(element, to, duration) {
var start = element.scrollTop,
change = to - start,
currentTime = 0,
increment = 20;