vtimofeev / vue-check-view

ISC License
115 stars 20 forks source link

When e.target is bigger than viewport... #9

Open panksi opened 5 years ago

panksi commented 5 years ago

So I have an element target which is bigger than viewport size, and viewHandler(e) fires exit from element before it actually leaves the viewport here is the printscreen of console.log image

I think this is because element is bigger and then something trippy happens to percent in view image

Its not a big issue but I think its worth fixing and making this plugin SUPERAWESOME! Anyway thanks for even making this, it really saved me the time

Suv4o commented 4 years ago

I am facing the same issue when an element is bigger than the viewport. It also happens with "e.percentTop". Basically it dose not indicates when you are in the middle of an element. It would be nice if you can implement this little feature as well.

Screen Shot 2020-01-01 at 13 59 28

Anyway, thank you very much for the great package. Good work!

simonhrogers commented 3 years ago

Yeah this is currently causing me woes too – I really need it to work for longer elements, as my use-case is tracking scroll position down a series of text elements for a navigation which highlights those currently on the screen.

simonhrogers commented 3 years ago

For what it’s worth, this workaround worked for me:

    viewHandler(e, section) {
      if (e.percentTop >= 0 && e.percentTop <= 1) {
        this.visibleSections.push(section);
      } else {
        this.visibleSections = this.visibleSections.filter(item => item._key !== section._key);
      }
    }