jQuery setTimeout delay for an element
- by Trouble
Is there an easier way to wait for an element to load ( by independant script/mootools/other ). For example:
I am waiting for a google map to load, but I don't want to use its API for checks. So I made two functions:
function checkIfexist() {
if(jQuery('#container').length)
return 0;
else
reload(1);
}
function reload(mode) {
setTimeout(function(){
do stuff
.
.
.
if(mode==1)
checkIfexist();
}, 400);
}
I am starting it with reload(1); Is there an easier way to use setTimeout in such a way? I don't want to use delay, wait or whatever.