the first thing is that you want to add all your listeners before setting the image src or you risk to miss the events. the second thing is that you need to wait for the load event or you can’t be sure that the image has dimensions, so the first solution is a no go.
1 Like