cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

Quick-add: + add another resource

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

Quick-add: + add another resource

Code Indentation

     

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

            
              <div id="container">
    <!-- This will make sure our size stays right when using Masonry -->
    <div class="grid-sizer"></div>
    <!-- This is what Masonry will tile for you -->
    <div class="item ">
        <!-- An image, of course! -->
        <img src="http://placehold.it/350x150" class="image">
        <!-- This is the overlay for the hover -->
        <span class="overlay" href="#">
            <h3 class="title">Some title 1</h3>
            <div class="description">
                <p>
                </p>
            </div>
        </span>
    </div>
    <div class="item">
        <!-- An image, of course! -->
        <img src="http://placehold.it/450x650" class="image">
        <!-- This is the overlay for the hover -->
        <span class="overlay" href="#">
            <h3 class="title">Some title 2</h3>
            <div class="description">
                <p>
                </p>
            </div>
        </span>
    </div>
    <div class="item">
        <!-- An image, of course! -->
        <img src="http://placehold.it/350x250" class="image">
        <!-- This is the overlay for the hover -->
        <span class="overlay" href="#">
            <h3 class="title">Some title 3</h3>
            <div class="description">
                <p>

                </p>
            </div>
        </span>
    </div>
    <div class="item">
        <!-- An image, of course! -->
        <img src="http://placehold.it/450x150" class="image" larger="yes">
        <!-- This is the overlay for the hover -->
        <span class="overlay" href="#">
            <h3 class="title">Some title 4</h3>
            <div class="description">
                <p>

                </p>
            </div>
        </span>
    </div>
    <div class="item">
        <!-- An image, of course! -->
        <img src="http://placehold.it/350x550" class="image">
        <!-- This is the overlay for the hover -->
        <span class="overlay" href="#">
            <h3 class="title">Some title 5</h3>
            <div class="description">
                <p>

                </p>
            </div>
        </span>
    </div>

    <div class="item">
        <!-- An image, of course! -->
        <img src="http://placehold.it/350x550" class="image">
        <!-- This is the overlay for the hover -->
        <span class="overlay" href="#">
            <h3 class="title">Some title 6</h3>
            <div class="description">
                <p>

                </p>
            </div>
        </span>
    </div>

    <div class="item">
        <!-- An image, of course! -->
        <img src="http://placehold.it/350x650" class="image">
        <!-- This is the overlay for the hover -->
        <span class="overlay" href="#">
            <h3 class="title">Some title 7</h3>
            <div class="description">
                <p>

                </p>
            </div>
        </span>
    </div>

    <div class="item">
        <!-- An image, of course! -->
        <img src="http://placehold.it/650x700" class="image">
        <!-- This is the overlay for the hover -->
        <span class="overlay" href="#">
            <h3 class="title">Some title 8</h3>
            <div class="description">
                <p>

                </p>
            </div>
        </span>
    </div>

    <div class="item">
        <!-- An image, of course! -->
        <img src="http://placehold.it/400x850" class="image">
        <!-- This is the overlay for the hover -->
        <span class="overlay" href="#">
            <h3 class="title">Some title 9</h3>
            <div class="description">
                <p>

                </p>
            </div>
        </span>
    </div>

    <div class="item">
        <!-- An image, of course! -->
        <img src="http://placehold.it/450x350" class="image">
        <!-- This is the overlay for the hover -->
        <span class="overlay" href="#">
            <h3 class="title">Some title 10</h3>
            <div class="description">
                <p>

                </p>
            </div>
        </span>
    </div>
</div>

            
          
!
            
              html {
  overflow-y: scroll;
}

body { font-family: sans-serif; }

/* ---- grid ---- */

* {
  box-sizing: border-box;
}

#container {
  background: #EEE;
  /* center */
  margin: 0 auto;
}

.item {
  max-width: 256px;
}

.item img {
  max-width: 100%;
}

.overlay {
    width: 100%;
    height: 100%;
    background-color: rgba(256,256,256,0.5);
    position: absolute;
    top: 0;
    left: 0;
    text-decoration: none;
    color: #fff;
    display: none;
}

.overlay .title {
    text-align: center;
    font-size: 18px;
}

.overlay .description {
    position: absolute;
    bottom: 0;
    left: 0;
    background-color: rgba(0,0,0,0.25);
    width: 100%;
    margin: 0;
}

.overlay .description a, .overlay .description a:visited {
  color: #f8ede9;
  text-decoration: none;
  display:block;
}

.overlay .description a:hover {
  color: #666666;
}

.overlay .description p {
  text-align: center;
}

/*.overlay .description p {
    margin: 10px;
}*/

.item:hover .overlay {
    display: block;
}
.featherlight:last-of-type{
  background:yellow;
}
            
          
!
            
              $(window).load( function() {

    $('#container').masonry({
        itemSelector: ".item",
        columnWidth: 256,
      isFitWidth: true,
      gutter: 10
        
    });

    $(".item").each(function() {
        var item = $(this); 
        var image = item.children('img').attr('src');
        $(item).find('.overlay').wrap('<a href="' + image + '" data-featherlight="image"></a>');

    });
      
});


            
          
!
999px
Loading ..................

Console