Skip to content

Instantly share code, notes, and snippets.

@abusedmedia
Created April 15, 2017 15:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save abusedmedia/ff8d5a545704569f7b118836f3c6f26f to your computer and use it in GitHub Desktop.
Save abusedmedia/ff8d5a545704569f7b118836f3c6f26f to your computer and use it in GitHub Desktop.
function gen(){
$('body').empty()
var number_column = parseInt(Math.random()*6) + 2
for(var i=0; i<number_column; ++i){
var number_rows = parseInt(Math.random()*50) + 5
var flex_value_col = Math.random()*10
var col = $('<div class="col" style="flex:'+flex_value_col+';"></div>')
$('body').append(col)
for(var j=0; j<number_rows; ++j){
var flex_value_row = Math.random()*10
var color = (Math.random()>.2) ? 'black' : 'white'
var border_bottom = (Math.random()>.5) ? 1 : 0
col.append('<div class="item" style="flex:'+flex_value_row+';background-color:'+color+';margin-bottom:'+border_bottom+'px;"></div>')
}
}
}
$('body').on('click', function(){
gen()
})
gen()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment