I have ONE external JavaScript file containing jQuery, Cufon, fonts, and the replace functions. I need this file to be loaded twice once on page load and again 3 seconds after page load. Is this possible?
+3
A:
Don't load it twice. Wrap what you have in it into a function, then call the function once when it loads, and once more after three seconds. For example, you might have something like this in your JavaScript file:
doSomeProcessing();
doSomeMoreProcessing();
Change it like this:
function myJavaScriptFile() {
doSomeProcessing();
doSomeMoreProcessing();
}
setTimeout(myJavaScriptFile, 3000);
myJavaScriptFile();
Amadan
2010-07-03 03:14:46
+1
A:
setTimeout(jQuery.getScript( url, [ success(data, textStatus) ] )),3000);
Orbit
2010-07-03 03:15:47