JSFiddle - React, Tailwind, and code Playground
by rodrigorf
HTML
<div class="Collage effect-parent">
<img src="http://placehold.it/350x150/69D2E7/ffffff" width="350" height="150"><img src="http://placehold.it/320x180/A7DBD8/ffffff" width="320" height="180"><img src="http://placehold.it/320x300/E0E4CC/ffffff" width="320" height="300"><img src="http://placehold.it/472x500/F38630/ffffff" width="472" height="500">
<img src="http://placehold.it/540x360/FA6900/ffffff" width="540" height="360"><img src="http://placehold.it/800x600/ECD078/ffffff" width="800" height="600"><img src="http://placehold.it/400x120/D95B43/ffffff" width="400" height="120"><img src="http://placehold.it/300x300/C02942/ffffff" width="300" height="300"><img src="http://placehold.it/320x500/542437/ffffff" width="320" height="500"><img src="http://placehold.it/450x300/53777A/ffffff" width="450" height="300">
</div>
CSS
body{
background-color:#F1F1F1;
}
.Collage img{
opacity:0;
border-radius: 1px;
/*
* Change this to try different borders
*/
/*border:1px solid #FFF;*/
}
.Collage{
/*
* Change this to set the spacing of the images in the grid
*/
padding:0px;
}
.footnote{
font-family:arial;
color:#999;
padding:10px;
font-size:12px;
}
.footnote a{
color:#09f;
text-decoration:none;
}
/* from transitions.css */
/*
A library of transitions for revealing the loaded images
(Heavily) Inspired by http://tympanus.net/codrops/2013/07/02/loading-effects-for-grid-items-with-css-animations/
*/
.effect-parent {
-webkit-perspective: 1300px;
-moz-perspective: 1300px;
perspective: 1300px;
}
/* EFFECT 1 */
.effect-1 {
-webkit-transform-style: preserve-3d;
-moz-transform-style: preserve-3d;
transform-style: preserve-3d;
-webkit-transform-origin: 50% 50% -300px;
-moz-transform-origin: 50% 50% -300px;
transform-origin: 50% 50% -300px;
-webkit-transform: rotateX(-180deg);
-moz-transform: rotateX(-180deg);
transform: rotateX(-180deg);
-webkit-animation: fly ease-in-out forwards;
-moz-animation: fly ease-in-out forwards;
animation: fly ease-in-out forwards;
}
@-webkit-keyframes fly {
100% { -webkit-transform: rotateX(0deg); opacity: 1; -webkit-transform-origin:50% 50% 0; }
}
@-moz-keyframes fly {
100% { -moz-transform: rotateX(0deg); opacity: 1; -moz-transform-origin:50% 50% 0; }
}
@keyframes fly {
100% { transform: rotateX(0deg); opacity: 1; transform-origin:50% 50% 0; }
}
/* EFFECT 2 */
.effect-2 {
-webkit-transform: translateY(200px);
-moz-transform: translateY(200px);
transform: translateY(200px);
-webkit-animation: moveUp ease forwards;
-moz-animation: moveUp ease forwards;
animation: moveUp ease forwards;
}
@-webkit-keyframes moveUp {
to { -webkit-transform: translateY(0); opacity: 1;...
JavaScript
/*!
*
* jQuery collagePlus Plugin v0.3.2
* https://github.com/ed-lea/jquery-collagePlus
*
* Copyright 2012, Ed Lea twitter.com/ed_lea
*
* built for http://qiip.me
*
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://www.opensource.org/licenses/mit-license.php
* http://www.opensource.org/licenses/GPL-2.0
*
*/
;(function(e){e.fn.collagePlus=function(t){function i(t,n,r,i){var o=r.padding*(t.length-1)+t.length*t[0][3],u=r.albumWidth-o,a=u/(n-o),f=o,l=n<r.albumWidth?true:false;for(var c=0;c<t.length;c++){var h=e(t[c][0]),p=Math.floor(t[c][1]*a),d=Math.floor(t[c][2]*a),v=!!(c<t.length-1);if(r.allowPartialLastRow===true&&l===true){p=t[c][1];d=t[c][2]}f+=p;if(!v&&f<r.albumWidth){if(r.allowPartialLastRow===true&&l===true){p=p}else{p=p+(r.albumWidth-f)}}var m=h.is("img")?h:h.find("img");m.width(p);if(!h.is("img")){h.width(p+t[c][3])}m.height(d);if(!h.is("img")){h.height(d+t[c][4])}s(h,v,r);m.load(function(e){return function(){if(r.effect=="default"){e.animate({opacity:"1"},{duration:r.fadeSpeed})}else{if(r.direction=="vertical"){var t=i<=10?i:10}else{var t=c<=9?c+1:10}e.addClass(r.effect);e.addClass("effect-duration-"+t)}}}(h)).each(function(){if(this.complete)e(this).trigger("load")})}}function s(e,t,n){var r={"margin-bottom":n.padding+"px","margin-right":t?n.padding+"px":"0px",display:n.display,"vertical-align":"bottom",overflow:"hidden"};return e.css(r)}function o(t){$img=e(t);var n=new Array;n["w"]=parseFloat($img.css("border-left-width"))+parseFloat($img.css("border-right-width"));n["h"]=parseFloat($img.css("border-top-width"))+parseFloat($img.css("border-bottom-width"));return n}var n={targetHeight:400,albumWidth:this.width(),padding:parseFloat(this.css("padding-left")),images:this.children(),fadeSpeed:"fast",display:"inline-block",effect:"default",direction:"vertical",allowPartialLastRow:false};var r=e.extend({},n,t);return this.each(function(){var t=0,n=[],s=1;r.images.each(function(u){var...