Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using its URL and the proper URL extension.

+ add another resource

JavaScript

Babel includes JSX processing.

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.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Auto Save

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.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="container">
  
  <div class="row" id="row-buttons">
    <div class="btn-toolbar" role="toolbar" aria-label="Button Toolbar">
      <div class="btn-group btn-group-filter mr-3" role="group" aria-label="Filter Buttons">
        Filter:&nbsp; 
        <button type="button" class="btn active btn-secondary" data-filter="*">All</button>
        <button type="button" class="btn btn-secondary" data-filter=".left">Left</button>
        <button type="button" class="btn btn-secondary" data-filter=".middle">Middle</button>
        <button type="button" class="btn btn-secondary" data-filter=".right">Right</button>
    </div>
			<div class="btn-group btn-group-sort mr-3" role="group" aria-label="Sort Buttons">
        Sort:&nbsp; 
        <button type="button" class="btn active btn-secondary" data-sort="original-order">Original</button>
        <button type="button" class="btn btn-secondary" data-sort="date">Date</button>
        <button type="button" class="btn btn-secondary" data-sort="colors">Colors</button>
        <button type="button" class="btn btn-secondary" data-sort="facing">Facing</button>
    </div>
      <div class="btn-group" role="group" aria-label="Filter Buttons">
        <button id="shuffle" type="button" class="btn btn-primary">Shuffle</button>
    </div>
  </div>
</div>
  
<div class="row" id="grid">
  <div class="grid-item right col-sm-6 col-md-4">
    <div class="interior">
      <span class="meta date">2017-09-16</span>
      <span class="meta colors">orange, white</span>
      <span class="meta facing">right</span>
    </div>
    <img src="https://bcgm3.com/dev/codepen/isotope/b1Xvq0v.jpg" />
  </div>
  <div class="grid-item middle col-sm-6 col-md-4">
    <div class="interior">
      <span class="meta date">2014-08-04</span>
      <span class="meta colors">white</span>
      <span class="meta facing">middle</span>
    </div>
    <img src="https://bcgm3.com/dev/codepen/isotope/Ib7eoOh.jpg" />
  </div>
  <div class="grid-item middle col-sm-6 col-md-4">
    <div class="interior">
      <span class="meta date">2013-02-17</span>
      <span class="meta colors">gray, white</span>
      <span class="meta facing">left</span>
    </div>
    <img src="https://bcgm3.com/dev/codepen/isotope/akteHnX.jpg" />
  </div>
  <div class="grid-item right col-sm-6 col-md-4">
    <div class="interior">
      <span class="meta date">2017-12-29</span>
      <span class="meta colors">orange, white</span>
      <span class="meta facing">right</span>
    </div>
    <img src="https://bcgm3.com/dev/codepen/isotope/W1mNjKE.jpg" />
  </div>
  <div class="grid-item middle col-sm-6 col-md-4">
    <div class="interior">
      <span class="meta date">2016-05-15</span>
      <span class="meta colors">black</span>
      <span class="meta facing">left</span>
    </div>
    <img src="https://bcgm3.com/dev/codepen/isotope/R2BNpt5h.jpg" />
  </div>
  <div class="grid-item left col-sm-6 col-md-4">
    <div class="interior">
      <span class="meta date">2017-02-23</span>
      <span class="meta colors">orange</span>
      <span class="meta facing">left</span>
    </div>
    <img src="https://bcgm3.com/dev/codepen/isotope/hDtpS4I.jpg" />
  </div>
  <div class="grid-item middle col-sm-6 col-md-4">
    <div class="interior">
      <span class="meta date">2015-05-07</span>
      <span class="meta colors">orange</span>
      <span class="meta facing">middle</span>
    </div>
    <img src="https://bcgm3.com/dev/codepen/isotope/o0NIPdd.jpg" />
  </div>
  <div class="grid-item middle col-sm-6 col-md-4">
    <div class="interior">
      <span class="meta date">2016-09-19</span>
      <span class="meta colors">gray, white</span>
      <span class="meta facing">middle</span>
    </div>
    <img src="https://bcgm3.com/dev/codepen/isotope/K9SPVMS.png" />
  </div>
  <div class="grid-item middle col-sm-6 col-md-4">
    <div class="interior">
      <span class="meta date">2013-07-23</span>
      <span class="meta colors">black, brown, white</span>
      <span class="meta facing">right</span>
    </div>
    <img src="https://bcgm3.com/dev/codepen/isotope/iAFyUXW.jpg" />
  </div>
  <div class="grid-item middle col-sm-6 col-md-4">
    <div class="interior">
      <span class="meta date">2014-08-25</span>
      <span class="meta colors">gray, white</span>
      <span class="meta facing">middle</span>
    </div>
    <img src="https://bcgm3.com/dev/codepen/isotope/7cASRSW.jpg" />
  </div>
  <div class="grid-item middle col-sm-6 col-md-4">
    <div class="interior">
      <span class="meta date">2017-10-21</span>
      <span class="meta colors">white</span>
      <span class="meta facing">middle</span>
    </div>
    <img src="https://bcgm3.com/dev/codepen/isotope/kEsuPDX.jpg" />
  </div>
  <div class="grid-item middle col-sm-6 col-md-4">
    <div class="interior">
      <span class="meta date">2016-09-16</span>
      <span class="meta colors">black</span>
      <span class="meta facing">middle</span>
    </div>
    <img src="https://bcgm3.com/dev/codepen/isotope/fsxzRA4.jpg" />
  </div>
  <div class="grid-item middle col-sm-6 col-md-4">
    <div class="interior">
      <span class="meta date">2016-11-08</span>
      <span class="meta colors">black, orange, white</span>
      <span class="meta facing">middle</span>
    </div>
    <img src="https://bcgm3.com/dev/codepen/isotope/dumjlE5.jpg" />
  </div>
  <div class="grid-item middle col-sm-6 col-md-4">
    <div class="interior">
      <span class="meta date">2014-03-04</span>
      <span class="meta colors">black, white</span>
      <span class="meta facing">middle</span>
    </div>
    <img src="https://bcgm3.com/dev/codepen/isotope/lpT1hgG.jpg" />
  </div>
  <div class="grid-item right col-sm-6 col-md-4">
    <div class="interior">
      <span class="meta date">2016-03-18</span>
      <span class="meta colors">black, orange, white</span>
      <span class="meta facing">right</span>
    </div>
    <img src="https://bcgm3.com/dev/codepen/isotope/BA38LiF.jpg" />
  </div>
  <div class="grid-item middle col-sm-6 col-md-4">
    <div class="interior">
      <span class="meta date">2015-04-16</span>
      <span class="meta colors">gray, white</span>
      <span class="meta facing">middle</span>
    </div>
    <img src="https://bcgm3.com/dev/codepen/isotope/I9D34Zv.jpg" />
  </div>
</div>
  
</div>
              
            
!

CSS

              
                .container {
  background-color: white;
}

.btn-toolbar {
  margin: 20px auto;
}

.grid-item {
  padding: 5px;
}

.interior {  
  position: absolute;  
}

.meta {
  opacity: 0.2;
  transition: opacity .5s;
  float: left;
  clear: left;
  padding: 0 5px;
  background: rgba( 255, 255, 255, 0.7 );
}

.grid-item:hover .meta {
  opacity: 1;
}

img {
  width: 100%;
  height: auto;
}
              
            
!

JS

              
                // INIT imageLoaded + Isotope
var $grid = $( '#grid' ).imagesLoaded( function() {
  // init Isotope after all images have loaded
  $grid.isotope( {
    itemSelector: '.grid-item',
    getSortData: {
      date: '.date',
      colors: '.colors',
      facing: '.facing'
    }
  } );
} );

// FILTER
$( '.btn-group-filter button' ).click( function(){
  // clear other btns' active states
  $( '.btn-group-filter button' ).removeClass('active');
  // set this btn active
  $( this ).addClass( 'active' );
  // set filter to btn's data-filter value
  var filter = $( this ).attr( 'data-filter' );
  $grid.isotope( { filter: filter } );
} );

// SORT
$( '.btn-group-sort button' ).click( function() {
  // clear other btns' active states
  $( '.btn-group-sort button' ).removeClass('active');
  // set this btn active
  $( this ).addClass( 'active' );
  // set sort to btn's data-sort value
  var sort = $( this ).attr( 'data-sort' );
  $grid.isotope( { sortBy: sort } );
} );

// SHUFFLE
$( '#shuffle' ).click( function(){
  $grid.isotope( 'shuffle' );
} );
              
            
!
999px

Console