resize observe update
This commit is contained in:
parent
6d34f7ffd9
commit
82655981ec
2 changed files with 22 additions and 2 deletions
|
@ -27,7 +27,17 @@ class InfiniteScroller{
|
|||
|
||||
this.scroll=scroll;
|
||||
this.scroll.addEventListener("scroll",this.watchForChange.bind(this));
|
||||
new ResizeObserver(this.watchForChange.bind(this)).observe(div);
|
||||
{
|
||||
let oldheight=0;
|
||||
new ResizeObserver(_=>{
|
||||
const change=oldheight-this.div.offsetHeight;
|
||||
if(change>0){
|
||||
this.scroll.scrollTop+=change;
|
||||
}
|
||||
oldheight=this.div.offsetHeight;
|
||||
this.watchForChange();
|
||||
}).observe(div);
|
||||
}
|
||||
new ResizeObserver(this.watchForChange.bind(this)).observe(scroll);
|
||||
|
||||
await this.firstElement(initialId)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue