forked from kombai/freewall
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
156 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,138 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<title>Live block's size</title> | ||
<meta content="text/html; charset=utf-8" http-equiv="content-type"> | ||
<script type="text/javascript" src="js/jquery-1.10.2.min.js"></script> | ||
<script type="text/javascript" src="../freewall.js"></script> | ||
<style type="text/css"> | ||
body { | ||
margin: 0; | ||
padding: 0; | ||
} | ||
article { | ||
float: left; | ||
overflow: hidden | ||
} | ||
img { | ||
display: block; | ||
width: 100%; | ||
height: auto; | ||
} | ||
.for6col article { | ||
width: 16.66%; | ||
} | ||
.for4col article { | ||
width: 25%; | ||
} | ||
.for2col article { | ||
width: 50% | ||
} | ||
</style> | ||
<script type="text/javascript"> | ||
|
||
$(document).ready(function () { | ||
|
||
var gutter = 20; | ||
|
||
function cellSize(containerWidth) { | ||
if (containerWidth > 1024) { | ||
var colNum = 6; | ||
} else if (containerWidth > 768) { | ||
var colNum = 4; | ||
} else { | ||
var colNum = 2; | ||
} | ||
|
||
return (containerWidth / colNum) - gutter; | ||
} | ||
|
||
|
||
var wall = new freewall("#freewall"); | ||
wall.reset({ | ||
selector: 'article', | ||
animate: true, | ||
cellW: cellSize, | ||
cellH: 'auto', | ||
|
||
cache: false, // don't cache block size; | ||
|
||
gutterX: gutter, | ||
gutterY: gutter, | ||
onResize: function (container) { | ||
var containerWidth = container.width(); | ||
|
||
if (containerWidth > 1024) { | ||
container.attr("class", "for6col"); | ||
} else if (containerWidth > 768) { | ||
container.attr("class", "for4col"); | ||
} else { | ||
container.attr("class", "for2col"); | ||
} | ||
|
||
wall.fitWidth(); | ||
|
||
document.title = containerWidth; | ||
} | ||
}); | ||
|
||
wall.fitWidth(); | ||
|
||
wall.container.find('.block img').load(function () { | ||
$(window).trigger("resize"); | ||
}); | ||
|
||
|
||
}); | ||
</script> | ||
</head> | ||
|
||
<body> | ||
<div id="freewall"> | ||
<article> | ||
<div class="block"> | ||
<div class="entry-content"> | ||
<img src="http://lorempixel.com/250/250/animals/" width="250" height="250" /> | ||
</div> | ||
</div> | ||
</article> | ||
<article> | ||
<div class="block"> | ||
<div class="entry-content"> | ||
<img src="http://lorempixel.com/250/250/animals/" width="250" height="250" /> | ||
</div> | ||
</div> | ||
</article> | ||
<article> | ||
<div class="block"> | ||
<div class="entry-content"> | ||
<img src="http://lorempixel.com/250/250/animals/" width="250" height="250" /> | ||
</div> | ||
</div> | ||
</article> | ||
<article> | ||
<div class="block"> | ||
<div class="entry-content"> | ||
<img src="http://lorempixel.com/250/250/animals/" width="250" height="250" /> | ||
</div> | ||
</div> | ||
</article> | ||
<article> | ||
<div class="block"> | ||
<div class="entry-content"> | ||
<img src="http://lorempixel.com/250/250/animals/" width="250" height="250" /> | ||
</div> | ||
</div> | ||
</article> | ||
<article> | ||
<div class="block"> | ||
<div class="entry-content"> | ||
<img src="http://lorempixel.com/250/250/animals/" width="250" height="250" /> | ||
</div> | ||
</div> | ||
</article> | ||
</div> | ||
</body> | ||
|
||
</html> |
This file contains 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
This file contains 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