Isotope with jQuery transit

HTML

<script src="http://isotope.metafizzy.co/jquery.isotope.min.js"></script>
<script src="https://raw.github.com/rstacruz/jquery.transit/master/jquery.transit.js"></script>
<script src="https://raw.github.com/carhartl/jquery-cookie/master/jquery.cookie.js"></script>
<div id="filters">
  <input type="checkbox" name="red" value=".red" id="red" class="box"><label for="red">red</label>
  <input type="checkbox" name="blue" value=".blue" id="blue" class="box"><label for="blue">blue</label>
  <input type="checkbox" name="green" value=".green" id="green" class="box"><label for="green">green</label>
  <input type="checkbox" name="yellow" value=".yellow" id="yellow" class="box"><label for="yellow">yellow</label>
</div>

<p><button id="shuffle">Shuffle</button></p>

<div id="container">
  <div class="item red"></div>
  <div class="item blue"></div>
  <div class="item green"></div>
  <div class="item yellow"></div>
  <div class="item red"></div>
  <div class="item blue"></div>
  <div class="item green"></div>
  <div class="item yellow"></div>
  <div class="item red"></div>
  <div class="item blue"></div>
  <div class="item green"></div>
  <div class="item yellow"></div>
  <div class="item red"></div>
  <div class="item blue"></div>
  <div class="item green"></div>
  <div class="item yellow"></div>
  <div class="item red"></div>
  <div class="item blue"></div>
  <div class="item green"></div>
  <div class="item yellow"></div>
</div>

CSS

body {
  font-family: 'Helvetica Neue', Arial, sans-serif;
}

#container {
  border: 1px solid;
  padding: 3px;
}

.item {
  width: 70px;
  height: 70px;
  margin: 3px;
  float: left;
}

.item.next {
  width: 60px;
  height: 60px;
  border: 5px solid black;
  border-radius: 35px;
}

.red { background: red; }
.blue { background: blue; }
.green { background: green; }
.yellow { background: yellow; }

/* Start: Recommended Isotope styles */

/**** Isotope Filtering ****/

.isotope-item {
  z-index: 2;
}

.isotope-hidden.isotope-item {
  pointer-events: none;
  z-index: 1;
}

/**** Isotope CSS3 transitions ****/

.isotope,
.isotope .isotope-item {
  -webkit-transition-duration: 0.8s;
     -moz-transition-duration: 0.8s;
          transition-duration: 0.8s;
}

.isotope {
  -webkit-transition-property: height, width;
     -moz-transition-property: height, width;
          transition-property: height, width;
}

.isotope .isotope-item {
  -webkit-transition-property: -webkit-transform, opacity;
     -moz-transition-property:    -moz-transform, opacity;
          transition-property:         transform, opacity;
}

/**** disabling Isotope CSS3 transitions ****/

.isotope.no-transition,
.isotope.no-transition .isotope-item,
.isotope .isotope-item.no-transition {
  -webkit-transition-duration: 0s;
     -moz-transition-duration: 0s;
          transition-duration: 0s;
}

/* End: Recommended Isotope styles */

JavaScript

$(function(){
   
  var $container = $('#container'),
      $checkboxes = $('#filters input');

  $("input.box").each(function() {
    var mycookie = $.cookie($(this).attr('name'));
    if (mycookie && mycookie == "true") {
        $(this).prop('checked', mycookie);
    }
});

$("input.box").change(function() {
    $.cookie($(this).attr("name"), $(this).prop('checked'), {
        path: '/',
        expires: 14
    });
});

    var initfilter = [];
    $checkboxes.filter(':checked').each(function(){
      initfilter.push( this.value );
    });
    initfilter = initfilter.join(', ');

  
  $container.isotope({
    itemSelector: '.item',
    filter: initfilter
  });
  
  $checkboxes.change(function(){
    var filters = [];
    // get checked checkboxes values
    $checkboxes.filter(':checked').each(function(){
      filters.push( this.value );
    });
    // ['.red', '.blue'] -> '.red, .blue'
    filters = filters.join(', ');
    $container.isotope({ filter: filters });
  });
    
  $('#shuffle').click(function(){
    $container.isotope('shuffle');
  });
 
   var $items = $container.children(); 
    
});