jquery: how to listen to the image loaded event of one container div?

后端 未结 3 650
温柔的废话
温柔的废话 2021-01-03 00:18

I have a container that has some images inside, I want to listen to the event of every image finish loaded.

eg)

<
3条回答
  •  孤城傲影
    2021-01-03 00:31

    $('#container img').load(function() {
      // ...
    });
    

    You'll want to set that up pretty close to the point at which the elements are introduced to the DOM, or else they might be loaded before you manage to attach the event handler.

提交回复
热议问题