Skip to content

jrs40492/smooth_scroll_js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

Smooth Scroll

A pure JavaScript smooth scroll animation for scrolling to sections of a site on button click.

This was built since the scrollIntoView method isn't fully supported in most modern browsers yet.

Helpers

  1. isOnScreen(element)
  • Determines if element is fully visible (nothing cut off)
  • Takes 1 parameter, a DOM element
  1. isPastScreen(element)
  • Determines if any part of the element has been scrolled out of view
  • Takes 1 parameter, a DOM element