From 3e5dcf512c37979b95f3b0fdfd2a7fb25586e6f5 Mon Sep 17 00:00:00 2001 From: David DeSandro Date: Sun, 11 Sep 2011 22:05:06 -0400 Subject: [PATCH] demos : use modulus for randomish size classes --- _includes/random-sizes.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/_includes/random-sizes.js b/_includes/random-sizes.js index f34508c..82e106e 100644 --- a/_includes/random-sizes.js +++ b/_includes/random-sizes.js @@ -1,10 +1,12 @@ - // hacky way of adding random size classes + // add randomish size classes $container.find('.element').each(function(){ - if ( Math.random() > 0.6 ) { - $(this).addClass('width2'); + var $this = $(this), + number = parseInt( $this.find('.number').text(), 10 ); + if ( number % 7 % 2 === 1 ) { + $this.addClass('width2'); } - if ( Math.random() > 0.6 ) { - $(this).addClass('height2'); + if ( number % 3 === 0 ) { + $this.addClass('height2'); } }); \ No newline at end of file