Skip to content

Instantly share code, notes, and snippets.

@isotrope
Created September 26, 2014 19:04
Show Gist options
  • Save isotrope/c294107e806cd2daa299 to your computer and use it in GitHub Desktop.
Save isotrope/c294107e806cd2daa299 to your computer and use it in GitHub Desktop.
A Pen by isotrope.
<h1>Isotope - packery layout mode</h1>
<div class="isotope">
<div class="item width2 height2"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item"></div>
<div class="item width2 height2"></div>
<div class="item"></div>
</div>
// external js:
// http://isotope.metafizzy.co/isotope.pkgd.js
// http://rawgit.com/metafizzy/isotope-packery/master/packery-mode.pkgd.js
$( function() {
$('.isotope').isotope({
layoutMode: 'packery',
itemSelector: '.item'
});
});
* {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
body {
font-family: sans-serif;
}
/* ---- isotope ---- */
.isotope {
background: #DDD;
max-width: 1200px;
}
/* clear fix */
.isotope:after {
content: '';
display: block;
clear: both;
}
/* ---- .item ---- */
.item {
float: left;
width: 200px;
height: 200px;
background: #0D8;
border: 2px solid #333;
border-color: hsla(0, 0%, 0%, 0.7);
}
.item.width2 { width: 400px; }
.item.height2 { height: 400px; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment