Isotope - IE7 transparent PNG
by wutyeetun87
HTML
<script src="http://isotope.metafizzy.co/jquery.isotope.min.js"></script>
<div id="filters" style="display:none;">
<input type="checkbox" name="red" value=".red" id="red"><label for="red">red</label>
<input type="checkbox" name="blue" value=".blue" id="blue"><label for="blue">blue</label>
<input type="checkbox" name="green" value=".green" id="green"><label for="green">green</label>
<input type="checkbox" name="yellow" value=".yellow" id="yellow"><label for="yellow">yellow</label>
</div>
<ul id="filter-list">
<li target="red">red</li>
<li target="blue">blue</li>
<li target="green">green</li>
<li target="yellow">yellow</li>
</ul>
<p><button id="shuffle">Shuffle</button></p>
<p>Click an square to select the next square, even after filters and sorts.</p>
<div id="container">
<div class="item red">Red</div>
<div class="item blue">blue</div>
<div class="item green">green</div>
<div class="item yellow">yellow</div>
<div class="item red">Red</div>
<div class="item blue">blue</div>
<div class="item green">green</div>
<div class="item yellow">yellow</div>
<div class="item red">Red</div>
<div class="item blue">blue</div>
<div class="item green">green</div>
<div class="item yellow">yellow</div>
<div class="item red">Red</div>
<div class="item blue">blue</div>
<div class="item green">green</div>
<div class="item yellow">yellow</div>
</div>
CSS
body {
font-family: 'Helvetica Neue', Arial, sans-serif;
}
#container {
border: 1px solid;
padding: 3px;
}
.item {
width: 60px;
height: 60px;
border: 5px solid;
margin: 3px;
float: left;
color: white;
background: url("http://i.imgur.com/G4KTT.png");
}
.red { border-color: red; }
.blue { border-color: blue; }
.green { border-color: green; }
.yellow { border-color: 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 */
#filter-list {float:left;width:100%;}
#filter-list li {float:left;padding:3px 10px;background:#dfdfdf;margin:10px 3px;display:block;}
#filter-list li.selected {background:#f60;}
JavaScript
$(function(){
var $container = $('#container'),
$checkboxes = $('#filters input');
$container.isotope({
itemSelector: '.item'
});
$('#filter-list li').on('click', function(){
if($(this).hasClass('selected'))
$(this).removeClass('selected');
else
$(this).addClass('selected');
$('#filters input[name='+$(this).attr('target')+']').trigger('click');
});
$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');
});
});