JavaScript Tutorial - 'load' event | Detect when images or the page has loaded

preview_player
Показать описание
By using the "load" event within JavaScript, you are able to detect when the web page or images, scripts etc. have finished loading. From there, you can run a callback function to take action.

In this video we take a look at two examples of the "load "event, one for the entire page and one that deals with individual images. Enjoy.

Support me on Patreon:

For your reference, check this out:

Follow me on Twitter @dcode!

If this video helped you out and you'd like to see more, make sure to leave a like and subscribe to dcode!
Рекомендации по теме
Комментарии
Автор

You are rapidly becoming my go-to JS Sensei! You rock!

MichaelProstka
Автор

Can you show the same with a preloader? Like the preloader will keep running until the images gets loaded then the preloader should disappear and website should open!

xavierfoster
Автор

Is it possible to apply load addEventListener to multiple images at the same time and do something once all images have been loaded?

senju
Автор

hi, amazing but how make it work on videos?

-MrHow-
Автор

In my case, the message is displayed first, than the image.

sbmahapatra
Автор

how to use this when a close button loads, then auto click it?

hillaryeatsbabies
Автор

What if the images don't have id's but are in a div class and inside an asset name? like

<div class="blahblah"> <img asset-name="image.png" /></div> How could I do something after this image has loaded, like click it's close button?

hillaryeatsbabies
Автор

i wanna ask how to do loader using sass only?
because my project strictly use css and sass only but all video sample in youtube all using java

anamarie
Автор

how o detect loaded images from multiple images(like 100) using javascript

nishad
Автор

Thanks for the video! =) who downvoted? >:-|

GustavoMartinZalazarGonzalez
Автор

Keyboard is very loud. Distracting and annoying

MR-list