I am loading messages in a scrollable chat window and I want to make sure the chat is scrolled to the bottom immediately after the images have loaded. Currently the load event is fired before the img's onload event resulting in my chat window's scroll position being slightly higher than it should.
Here is my current workaround (I am using useImg):
const el = this.el.nativeElement as HTMLElement;
const image = el.getElementsByTagName('img')[0] as HTMLImageElement;
image.onload = () => {
// Custom logic
};
I have to find the img tag in whatever component I am using and then manually wait for the onload event.
I am loading messages in a scrollable chat window and I want to make sure the chat is scrolled to the bottom immediately after the images have loaded. Currently the
load
event is fired before the img'sonload
event resulting in my chat window's scroll position being slightly higher than it should.Here is my current workaround (I am using
useImg
):I have to find the img tag in whatever component I am using and then manually wait for the onload event.