K
K
Kryptonit2020-05-17 18:18:10
JavaScript
Kryptonit, 2020-05-17 18:18:10

Find out if the scroll has scrolled to the element with id (js)?

Where is the mistake

let animate = document.querySelector('.skills');

document.querySelector('body').addEventListener('scroll', function(){
        if( animate.getBoundingClientRect().top <= 700){
        console.log("hello");}
    })

Task: if I scroll up to 700 pixels from the top of the element, there should be an output to the console

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artem0071, 2020-05-17
@Artem0071

I understand this is what you are looking for .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question