I wrote a short script in JS to mimic effect made in Flash.
It is working in FF 3.6, but it not working in Chrome, Opera or IE8.
Everything is working except .css({opacity: opacity});
Have I missed something? Thanks. edit: I was missing closing quote.
Live: http://webarto.com/static/demo/cubes/
var cubes = 16;
var x = cubes;
var y = cubes;
var n = 1;
$(document).ready(function () {
var cubes = $("#cubes");
for (i = 1; i <= x; i++) {
for (j = 1; j <= y; j++) {
cubes.append('<div id="cube_' + n + '"></div>');
n++;
}
}
setInterval(cube, 50);
});
function cube() {
var rand = Math.floor(Math.random() * 256);
var opacity = Math.random() * 0.8;
$("#cube_" + rand).css({
opacity: opacity
});
}
Thanks to @Gaby aka G. Petrioli for optimization.
cubefunction seems to be working properly: jsbin.com/ozice4/2/edit -- Tested in Chrome and didn't see a problem.