Pen Settings



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


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


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.


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.


                <h1>Isotope + imagesLoaded, iteratively reveal items</h1>
<div class="grid"></div>
<p><button id="load-images">Load images</button></p>



                body { font-family: sans-serif; }

.grid {
  background: #DDD;
  max-width: 1000px;

.grid-item {
  width: 200px;
  float: left;

.grid-item img {
  display: block;
  width: 100%;

button { font-size: 18px; } 


                // external js: isotope.pkgd.js, imagesloaded.pkgd.js

var $grid = $('.grid').isotope({
  itemSelector: '.grid-item',
  masonry: {
    columnWidth: 200  

$('#load-images').click( function() {
  var $items = getItems();
  $grid.isotopeImagesReveal( $items );

$.fn.isotopeImagesReveal = function( $items ) {
  var iso ='isotope');
  var itemSelector = iso.options.itemSelector;
  // hide by default
  // append to container
  this.append( $items );
  $items.imagesLoaded().progress( function( imgLoad, image ) {
    // get item
    // image is imagesLoaded class, not <img>, <img> is image.img
    var $item = $( image.img ).parents( itemSelector );
    // un-hide item
    // isotope does its thing
    iso.appended( $item );
  return this;

function randomInt( min, max ) {
  return Math.floor( Math.random() * max + min );

function getItem() {
  var width = randomInt( 150, 400 );
  var height = randomInt( 150, 250 );
  var item = '<div class="grid-item">'+
    '<img src="' + 
      width + '/' + height + '/nature" /></div>';
  return item;

function getItems() {
  var items = '';
  for ( var i=0; i < 12; i++ ) {
    items += getItem();
  // return jQuery object
  return $( items );