I want to generate properties to a known number of divs but i can figure out where did i go wrong. What i have tried for now is:
$(document).ready(function(){
for(var i=1; i<=7; i++)
{
var randBottom = Math.ceil(Math.random()*200);
var randHeight = Math.ceil(Math.random()*300)+200-randBottom;
var randWidth = Math.ceil(Math.random()*50)+20;
var oceanWidth= $("#ocean").css(["width"]);
var randLeft= Math.ceil(Math.random()*oceanWidth)-randWidth;
var cssObj = {
'bottom' : randBottom+'px',
'height' : randHeight+'px',
'widht' : randWidth+'px
};
$("#bubble"+i).css(cssObj);
}
});
Here is a complete work-in-progress sample.