Recover id as per javascript scroll

Asked

Viewed 21 times

0

Personal talk, Loveliness?

I have a little problem here and I need your help hehehehe.

I have the following situation

<section id="section">    
//TODO CODE
</section>

And I’m having a doubt of collecting the id of the Ction with the js when I pass with the scroll, currently I do something like evt.path[1].window.scrollY > 1700 so that I can give action on a Function, but I need that when I scroll over the element I can collect that id, or that I notify me something that I’m on top of that element.

Thank you for your attention, Thank you!!!

  • It will look something like https://answall.com/q/68612/129?

  • Opa Sergio, it wasn’t quite that, but gave me another idea. Thanks, anyway thanks for the help.

1 answer

-1


Solution:

window.addEventListener('scroll', evt => {
                   evt.path[1].window.scrollY > x.target.getBoundingClientRect().top ? variavel : null
                });

Browser other questions tagged

You are not signed in. Login or sign up in order to post.