aos icon indicating copy to clipboard operation
aos copied to clipboard

Add "container" setting, to allow attaching AOS to any scrollable element

Open m-kutnik opened this issue 6 years ago • 9 comments

Related Issue

Issue: #223

Your solution

  • Added container to AOS options (default: window).
  • Variable container is pointing to HTML Element, or to Window if querySelector returns null.
  • EventListener is passing container to handleScroll() as a second argument
  • handleScroll() evaluates scroll distance by using Element.scrollTop or Window.pageYOffset

Defining scrollable element

AOS.init({
  container: ".scrollable-div"
})

How Has This Been Tested?

  • By running included tests

In own projects, tested on:

  • Desktop: Firefox 62, Chrome 71, Edge 42
  • Android: Chrome, Firefox

m-kutnik avatar Sep 12 '18 07:09 m-kutnik