No-Js Image Preview
by James Doyle
HTML
<script src="https://raw.github.com/LeaVerou/prefixfree/gh-pages/plugins/prefixfree.dynamic-dom.min.js"></script>
<div id="gallery">
<ul>
<li><img src="http://dribbble.s3.amazonaws.com/users/2559/screenshots/706232/screen_shot_2012-08-28_at_9.30.41_am.png"></li>
<li><img src="http://dribbble.s3.amazonaws.com/users/31630/screenshots/704843/chrome_glyphs.png"></li>
<li><img src="http://dribbble.s3.amazonaws.com/users/2553/screenshots/704438/img_64uu53.jpg"></li>
<li><img src="http://dribbble.s3.amazonaws.com/users/96387/screenshots/705786/dribbblemano.png"></li>
</ul>
<div id="show">
</div>
</div>
CSS
#gallery {
}
#gallery ul {
margin: 0;
padding: 0;
}
#gallery ul li {
list-style: none;
display: block;
margin: 10px;
height: 100px;
width: 100px;
overflow: hidden;
box-shadow: inset 0 1px 0 rgba(255,255,255,0.5);
border: 1px solid #222;
border-radius: 5px;
box-sizing: border-box;
background-clip: border-box;
background: -moz-linear-gradient(top, #555 0%, #000000 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#555), color-stop(100%,#000000)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #555 0%,#000000 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #555 0%,#000000 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #555 0%,#000000 100%); /* IE10+ */
background: linear-gradient(to bottom, #555 0%,#000000 100%); /* W3C */
-webkit-transition: -webkit-transform 0.2s ease;
}
#gallery ul li img {
opacity: 0.3;
border-radius: inherit;
-webkit-transform-origin: top left;
-webkit-transform: scale(0.5);
}
#gallery ul li:hover img {
opacity: 0.4;
}
#gallery ul li:active {
overflow: visible;
-webkit-transform: translate3d(110px, -30%, 0);
width: 402px;
height: 302px;
box-shadow: 0 1px 10px rgba(0,0,0,0.5);
margin-bottom: -202px;
}
#gallery ul li:active img {
opacity: 1;
-webkit-transform: scale(1);
}
#gallery ul li:first-child:active{
-webkit-transform: translate3d(110px, 0, 0);
}
#gallery ul li:last-child:active {
-webkit-transform: translate3d(110px, -202px, 0);
}