Let me explain what I would like to do. I have developed a web app and before my animation runs I would like to make sure that the images used in the animation have been loaded into the browser. As such here is my JavaScript:
$(document).ready(function(){
$.mobile.loading( 'show', {
text: 'Downloading Web App',
textVisible: true,
theme: 'a',
html: ""});
document.getElementById('Logo').onload = function()
{
if(KeepCount == 0)
{
KeepCount++;
}
else if(KeepCount == 1)
{
KeepCount = 0;
$.mobile.loading( 'hide' );
StartSplash();
}
};
document.getElementById('Hand').onload = function(){
if(KeepCount == 0)
{
KeepCount++;
}
else if(KeepCount == 1)
{
KeepCount = 0;
$.mobile.loading( 'hide' );
StartSplash();
}
};
});
KeepCount is declared globally. I've checked this in chromes developer tools and somehow the onload functions are never fired for some reason. Here is the HTML:
<img id='Logo' class="logo objecttransition" src="css/images/Logo.gif">
<img id='Hand' class="hand objecttransition" src="css/images/hand.gif">
Any ideas?
$.readyfunction, it is very likely that the images have already loaded by the time you assign the onload event. onload won't fire if the images have already been loaded.