Javascript: bind scroll or resize event for which element is better?

I always see people connect scrolland resizeevent elementwindow

How to associate this event with documentor document.documentElementeven document.bodyelment?

Is there any flaw?

+4
source share
2 answers

The Resize event is only supported by the window element, so binding it to any other element will not work. I would like to be able to handle resizing for any element, but there is no native event to bind, so when I need to resize the descriptor, I have to check the size of the element every XXX ms.

, , . , , . < & GT; , overflow:auto/scroll , .

, ;)

+1

DOM:

DOM . , , .

, , .

0

Source: https://habr.com/ru/post/1537612/


All Articles