[removed] Know when an image is fully loaded

前端 未结 7 1158
旧巷少年郎
旧巷少年郎 2020-11-30 02:42

If I have a beacon:


I want a method to be called once the beacon request finishes. Somethin

7条回答
  •  既然无缘
    2020-11-30 02:57

    
    

    This will load the StackOverflow logo.

    If it loads successfully, the alert('Image Loaded'); is performed.
    If it fails, the alert('Error Loading Image'); is performed.

    Of course, either of these can be replaced with your own functions. As a new user, It refused my image tag but the image tag should only contain the id='beacon' attribute. unless you want to add a class. We're setting the src attribute in code here, typically images that you are monitoring for completion have src values that are set programmatically anyway.

提交回复
热议问题