One animated background image for multiple elements in Safari
I’ve found out that Safari can’t handle the same animated gif as background for multiple elements, it will just animate one of them at the same time. On a project I’m currently working on my I use the following trick to make all requests to the background image (in this case indicator_black.gif
) unique.
[...]<br />
var text = transport.responseText;<br />
if (Browser.WebKit) {<br />
text = text.gsub('indicator_black.gif', function(match) {<br />
return match + '?' + new Date().valueOf() +<br />
Math.round(Math.random() * 5000);<br />
});<br />
}<br />
[...]
Note that it uses Prototype JavaScript framework and you should too.