Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 140788

How-to display a .gif as background image?

$
0
0

I have a javascript "loading" function like this:

function splashScreen() {
    var div = document.createElement('div');
    div.appendChild(document.createTextNode("some text"));
    div.style.position = "fixed";
    div.style.width = "100%";
    div.style.height = "100%";
    div.style.left = "0";
    div.style.top = "0";
    div.style.zIndex = "1000";
    div.style.background = "white url('img/ajax-loader.gif') no-repeat center";
    div.style.fontSize = "x-large";
    div.style.textAlign = "center";
    div.style.lineHeight = "3em";
    div.style.opacity = "0.75";
    div.style.filter = "alpha(opacity=75)"; // fix ie
    document.body.appendChild(div);
    return true;
}

I use this function in the form action (onsubmit="return splashScreen()") to show a "rotating logo" while the next page load... The problem is in that "img/loading.gif" and safari (on winXP): in ff and ie I have no problems, and I clearly see the animated gif. In safari I can't see it. If I change the image with a (obviously static) png the image appears... Am I doing something wrong? What's the problem with safari?


Viewing all articles
Browse latest Browse all 140788

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>