Check if images are loaded?

后端 未结 3 462
野趣味
野趣味 2020-11-27 07:36

I\'m looking for a sulotion that check if all images are loaded before they are used in a image slider/rotator. I was thinking of a solution that only show the buttons or th

3条回答
  •  死守一世寂寞
    2020-11-27 08:25

    You can trigger off each $('img').load() event and enable the related link / click event only once your load has triggered. Advantage to doing it image by image is if certain images are taking longer to load you could still allow the quick ones to be 'clickable'.

    $('img').load(function() {
        // find the related link or click event and enable/add it
    });
    

提交回复
热议问题