preload an array of images with jquery

前端 未结 1 924
无人及你
无人及你 2021-01-13 03:10

I am using jQuery to build an array of images from a php array. I want to loop through these images, preloading them while displaying a little loading gif until all of the i

1条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-13 03:56

    You are creating a sting and inserting it into the document, where it should become a part of DOM. What you need to do is create a JS Image object, somewhat like this:

    // Preload Images:
    for(i=0; i

    0 讨论(0)
提交回复
热议问题