I have the following 2 functions:
function setPanelTo(panel,id){
$.getJSON("https://e926.net/posts/"+id+".json?_client="+clientname, function( data ) {
var img = document.createElement("img")
img.classList.add("panel")
img.src = data.post.file.url;
comic.append(img)
});
}
function getPoolByID(id){
comic.innerHTML = "";
$.getJSON("https://e926.net/pools/"+id+".json?_client="+clientname, function( data ) {
for (var x = 0; x < data.post_ids.length; x++){
setPanelTo(x,data.post_ids[x]);
}
});
}
and when I call the getPoolByID();
function, it populates the 'comic' <div>
element with images. However, the images do not appear in the correct order, which slightly undermines the point of a comic.
How do I make it so that the images don't load until the previous image has loaded?
Note: I've tried using a table, and while it worked, the images did not wrap when they reached the edge of the page, which is a must have for this.