LukeCarlThompson / scroll-to-anchor

A vanilla js function for scrolling to anchors

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Scroll To Anchor

A minimal smooth scroll function

Use like this (defaults shown).

const smoothScroll = new ScrollToAnchor({
  offset: 0, // integer in pixels from the top of window
  duration: 1000, // integer in ms the scroll animation will go for
});

A template built for creating javascript libraries and general tinkering.

It uses gulp, scss, browserSync, Rollup and buble.

Folder structure

_src/ - is where you work
dev/ - is where the browserSync server runs from
dist/ - contains the processed js files

Get started

  1. npm install - install dependencies
  2. npm run dev - spins up the dev server
  3. npm run build - transpiles and builds final js files in dist/ folder

About

A vanilla js function for scrolling to anchors

License:MIT License


Languages

Language:JavaScript 78.9%Language:HTML 14.1%Language:CSS 6.9%