camwiegert / in-view

Get notified when a DOM element enters or exits the viewport. :eyes:

Home Page:https://camwiegert.github.io/in-view

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Is there a way to set multiple offsets for different DOM nodes

emilie-nagahama opened this issue · comments

Hey!

First off - great plugin! I'm hoping to set multiple offsets for different DOM nodes in the viewport. I'd like to be able to either chain animations or target multiple elements at different enter and exit stages.

Is it possible to pass the offset value as a second parameter to inView?

For example:

InView('.select-element', 250)
      .on('enter', function(el) {
        document.querySelectorAll('intro-content-left').classList.add('fadeOutIntro');
      })
      .on('exit', function(el){
        document.querySelectorAll('.intro-content-left').classList.remove('fadeOutIntro');
      });

There's a similar issue here: #44 but doesn't seem to have been implemented.
Thanks!