Skip to content

Commit

Permalink
demos : use modulus for randomish size classes
Browse files Browse the repository at this point in the history
  • Loading branch information
desandro committed Sep 12, 2011
1 parent 06f43b4 commit 3e5dcf5
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions _includes/random-sizes.js
Original file line number Diff line number Diff line change
@@ -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');
}
});

0 comments on commit 3e5dcf5

Please sign in to comment.