JSFiddle - React, Tailwind, and code Playground

by will525

HTML

<div class="viewport">
    <a href="#">
        <span class="dark-background"></span>
        <img src="http://farm4.static.flickr.com/3641/3479048548_e58742bd46.jpg" alt="" />
    </a>
</div>

CSS

/* --- Container configuration ---------------------------------------------------------- */
.viewport {
    border: 3px solid #eee;
    float: left;
    height: 299px;
    margin: 0 9px 9px 0;
    overflow: hidden;
    position: relative;
    width: 450px;
}

/* This is so that the 2nd thumbnail in each row fits snugly. You will want to add a similar
   class to the last thumbnail in each row to get rid of the margin-right. */
.no-margin {
    margin-right: 0;
}

/* --- Link configuration that contains the image and label ----------------------------- */
.viewport a {
    display: block;
    position: relative;
}

.viewport a img {
    height: 332px;
    left: -20px;
    position: relative;
    top: -20px;
    width: 500px;
}

/* --- Label configuration -------------------------------------------------------------- */
.viewport a span {
    display: none;
    font-size: 3.0em;
    font-weight: bold;
    height: 100%;
    padding-top: 120px;
    position: absolute;
    text-align: center;
    text-decoration: none;
    width: 100%;
    z-index: 100;
}
    .viewport a span em {
        display: block;
        font-size: 0.45em;
        font-weight: normal;
    }

/* --- Dark hover background ------------------------------------------------------------ */
.dark-background {
    background-color: rgba(15, 15, 15, 0.6);
    color: #fff;
    text-shadow: #000 0px 0px 20px;
}
    .dark-background em {
        color: #ccc;
    }

/**
 * You could create multiple hover background classes for different looks depending on the
 * image type. Use your imagination!
 */

JavaScript

$(document).ready(function() {
    $('.viewport').mouseenter(function(e) {
        $(this).children('a').children('img').animate({ height: '299', left: '0', top: '0', width: '450'}, 100);
        $(this).children('a').children('span').fadeIn(200);
    }).mouseleave(function(e) {
        $(this).children('a').children('img').animate({ height: '332', left: '-20', top: '-20', width: '500'}, 100);
        $(this).children('a').children('span').fadeOut(200);
    });
});