M
M
Maxim2018-03-12 18:32:12
JavaScript
Maxim, 2018-03-12 18:32:12

I get undefined with elem.srollY. Where is the mistake?

Hey!
Here is the demo.
I'm trying to display the distance in pixels from the top edge of the window to the element with the item5 class when scrolling.
But I get undefined.
Can't figure out why

console.log(window.scrollY); // Выдаёт расстояние в пикселях
console.log(elem.scrollY); // А тут получаю undefined.

Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikolai Shabalin, 2018-03-12
@Tispartaaaa

scrollY — свойство только для чтения интерфейса Window

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question