Created
July 25, 2014 09:09
-
-
Save raphaelsaunier/df444050e2dfec5937f2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
body {background: #ccc;} | |
* {box-sizing:border-box;} | |
#container {width:300px;background:#eee;margin:0 auto} | |
.item {height:150px; width: 100px; background: white; | |
border:1px solid #ddd;line-height:50px;text-align:center;font-family:sans-serif;color:#ccc; font-size:20px;color:black;} | |
.item:after {color:gray;font-size:10px;} | |
.item.one-by-one:after {content:"1x1"} | |
.item.one-by-two {width:200px;} | |
.item.one-by-two:after {content:"1x2"} | |
.item.two-by-two {width:200px;height:300px;line-height:200px;} | |
.item.two-by-two:after {content:"2x2"} | |
.item.one-by-three {width:300px;} | |
.item.one-by-three:after {content:"1x3"} | |
#container { | |
counter-reset: item-counter; | |
} | |
.item:before { | |
content: counter(item-counter) ". "; | |
color:#999; | |
counter-increment: item-counter; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> | |
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery.isotope/2.0.0/isotope.pkgd.min.js"></script> | |
</head> | |
<body> | |
<div id="container"> | |
<!-- | |
Cards are automatically positioned by Isotope (http://isotope.metafizzy.co/) | |
to minimise the occurence of gaps in the layout, the sorting order can | |
be defined using an optional data-priority attribute. | |
--> | |
<div data-priority="90" class="item one-by-three"></div> | |
<div data-priority="89" class="item one-by-two"></div> | |
<div data-priority="88" class="item one-by-one"></div> | |
<div data-priority="79" class="item one-by-one"></div> | |
<div data-priority="78" class="item one-by-two"></div> | |
<div data-priority="69" class="item one-by-one"></div> | |
<div data-priority="68" class="item one-by-one"></div> | |
<div data-priority="67" class="item one-by-one"></div> | |
<div data-priority="59" class="item one-by-two"></div> | |
<div data-priority="58" class="item one-by-one"></div> | |
<div data-priority="49" class="item one-by-one"></div> | |
<div data-priority="48" class="item two-by-two"></div> | |
<div data-priority="47" class="item one-by-one"></div> | |
<div class="item one-by-one"></div> | |
<div class="item one-by-one"></div> | |
<div class="item one-by-one"></div> | |
<div class="item one-by-one"></div> | |
<div class="item one-by-one"></div> | |
</div> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(function(){ | |
var $container = $('#container').isotope({ | |
itemSelector: '.item', | |
masonry: { columnWidth : 100 }, | |
getSortData: { | |
priority: '[data-priority]' | |
}, | |
sortBy : 'priority', | |
sortAscending: false | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment