Skip to content

abhay-vats/js-scroll-to-accept

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Scroll To Accept

This is a simple demo showing the working of scroll-to-bottom-to-accept functionality; generally found in TnC page on sites. This functionality was built using vanilla JavaScript.

Things I learned while building this:

  • IntersectionObserver() constructor function and its powerful usage,
  • Why not to use scrollTop and scrollHeight to achieve same functionality (Answer: It's unnecessary nowadays),
  • Logical yet surprising things at first sight, e.g., scroll events do not bubble up,
  • And, finally, how to put everything together.

Code | Live

About

A simple demo of scroll-to-accept functionality

Topics

Resources

Stars

Watchers

Forks