티스토리 뷰

공부

[jQuery] check loaded image

승가비 2020. 7. 28. 22:19
728x90
$("<img/>")
    .on('load', function() { console.log("image loaded correctly"); })
    .on('error', function() { console.log("error loading image"); })
    .attr("src", $(originalImage).attr("src"))
;

https://stackoverflow.com/questions/1977871/check-if-an-image-is-loaded-no-errors-with-jquery

 

Check if an image is loaded (no errors) with jQuery

I'm using JavaScript with the jQuery library to manipulate image thumbnails contained in a unordered list. When the image is loaded it does one thing, when an error occurs it does something else. I'm

stackoverflow.com

 

728x90

'공부' 카테고리의 다른 글

[Django] not like statement  (0) 2020.07.28
[Django] filter query  (0) 2020.07.28
[Python] KafkaConsumer start consuming messages from a timestamp  (0) 2020.07.24
[Presto] function  (0) 2020.07.24
[Spark] function  (0) 2020.07.24
댓글