In order to execute all commands once the page has been loaded, I am maintaing an array which pushes all the commands. This is being done via:
<img src='holder.js/200x280/text:name'
alt='name' width='200px'
onload='getPoster(this, name)'>
This is an iterative process and is run in a loop approximately 20 times.
I want that once this has been completed (page is completely loaded) and all the onload()
events have been stacked into the array, execute each one by one.
I thought that $(document).ready()
would let me achieve this, but it isn't helping either. However, using a setTimeout()
function lets be see the ultimate result. But that obviously is not a good thing to do.
getPoster function:
function getPoster(img, title) {
commands.push(new titles(img, title));
}
How do you think I should go about to load the images once all the onload events are stacked?