jquery - Randomly position divs on page load -


i looking randomly position batch of divs on screen when page loads - i'd opacity value , size random on load. tips on how achieve this? looking jquery way // thanks

for (var i=1; <= 3; i++) {     // minimum 0 , maximum 60%. can change that.       var x = math.max(0, math.min(60, math.ceil(math.random() * 100)));     var y = math.max(0, math.min(60, math.ceil(math.random() * 100)));     $('<div />').css({         position: 'absolute',         width: '300px',         height: '100px',         top: y + '%',         left: x + '%',         'background-color': 'rgba(0,0,0,' + math.random() + ')'     }).text('top:' + y + ', left:' + x).appendto('body'); } 

http://jsfiddle.net/hspvadfv/

it's turn play math , change var x , y.


Comments

Popular posts from this blog

javascript - Any ideas when Firefox is likely to implement lengthAdjust and textLength? -

matlab - "Contour not rendered for non-finite ZData" -

delphi - Indy UDP Read Contents of Adata -