Skip to content
Advertisement

how to show image only when it is completely loaded?

I have an img tag on my web page. I give it the url for an IP camera from where it get images and display them. I want to show image when it is completely loaded. so that I can avoid flickering. I do the following.

JavaScript

javascript code

JavaScript

in this code. when image is large. it takes some time to load. in the mean time it start showing the part of image loaded. I want to display full image and skip the loading part Thanks

Advertisement

Answer

Preload the image and replace the source of the <img /> after the image has finished loading.

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement