Yes @vetras
, usually web-app's shows the loading at bottom of the div in case of infinite scrolling. Other way I thought of was set target to last element of the list, but in that case we have to change the observer target when list updates. If you know any other way please share, it will be helpful. Thanks :)
What I usually see when we have DOM elements we want to show or hide dynamically is to have a display property on them (not just shove them outside the view 🙏 ).
The
div id="loading"
never leaves the page. It is just pushed further down.This is weird ... but OK I guess the main point is using the
IntersectionObserver
and looking at the value of theintersectionRatio
to make decisions.That same principle can be applied to other things as you mention at the top. Cool.
Yes @vetras , usually web-app's shows the loading at bottom of the div in case of infinite scrolling. Other way I thought of was set target to last element of the list, but in that case we have to change the observer target when list updates. If you know any other way please share, it will be helpful. Thanks :)
What I usually see when we have DOM elements we want to show or hide dynamically is to have a display property on them (not just shove them outside the view 🙏 ).
For example:
(full stack dev here, FYI, so my FE well...)
Oh yes, I completely missed this. Let me think of this how it will be achieved as target element is required to pass the in
observe
method.