[removed] how to load all images in a folder?

前端 未结 4 1256
你的背包
你的背包 2020-12-06 18:18
var img = new Image();
img.src = \"images/myFolder/myImage.png\";

The above will only load myImage.png. How to load all images of myFolder?

4条回答
  •  醉酒成梦
    2020-12-06 19:17

    You need some way to get the list of files in that folder. This can either be defined manually as an array, or retrieved by an AJAX request to a server-side script that lists the files for you. Either way, there no "magic" method to get all the images in a folder.

提交回复
热议问题