If I have a beacon:
I want a method to be called once the beacon request finishes. Somethin
You can do it easily in two way.lets see the ways:
1.Using onload
attribute in img
tag:
<img onload="alert('loaded');" src="https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png">
This will trigger alert just after the photo is finished loading.
2.Using EventListener
in JavaScript:
document.getElementsByTagName("img");.addEventListener("load", function loaded(){
//any code you may need
});
These code goes in your external js
file or internal script tag.
You can do this for every individual img
tag using class
and id
attribute.