cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmloctocatspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

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.

            
              <h1>Packery - ignore elem</h1>
<p>ignore() and unignore() are undocumented methods that allow you to ignore item elements</p>
<button class="button">toggle ignorable item</button>
<div class="packery has-stamp">
  <div class="item w2 h2 ignore"></div>
  <div class="item"></div>
  <div class="item h4"></div>
  <div class="item w2"></div>
  <div class="item"></div>
  <div class="item h2"></div>
  <div class="item w2 h2"></div>
  <div class="item"></div>
  <div class="item w4"></div>
  <div class="item"></div>
  <div class="item"></div>
  <div class="item"></div>
  <div class="item h4"></div>
  <div class="item w2"></div>
  <div class="item"></div>
  <div class="item h2"></div>
  <div class="item w2 h2"></div>
  <div class="item"></div>
  <div class="item w4"></div>
  <div class="item"></div>
  <div class="item"></div>
</div>

            
          
!
            
              * {
  -webkit-box-sizing: border-box;
     -moz-box-sizing: border-box;
          box-sizing: border-box;
}

body { font-family: sans-serif; }

.packery {
  background: #FDD;
  background: hsla(45, 100%, 40%, 0.2);
  max-width: 520px;
}

/* clearfix */
.packery:after {
  content: ' ';
  display: block;
  clear: both;
}

.item {
  opacity: 0.8;
  width: 40px;
  height: 40px;
  float: left;
  background: #C09;
  border: 4px solid #333;
  border-color: hsla(0, 0%, 0%, 0.3);
}

.item.w2 { width:   80px; background: #9C0; }
.item.h2 { height:  80px; background: #0C9; }
.item.h4 { height: 160px; background: #C90; }
.item.w4 { width:  160px; background: #90C; }

.item.ignore {
  border-style: dotted;
  border-color: white;
  background: red;
}

button {
  font-size: 24px;
}

            
          
!
            
              // http://packery.metafizzy.co/packery.pkgd.js added as external resource


docReady( function() {
  var button = document.querySelector('button');
  var container = document.querySelector('.packery');
  var pckry = new Packery( container, {
    // do not layout on init
    isInitLayout: false,
    itemSelector: '.item'
  });
  // ignore that element
  var ignorableElem = container.querySelector('.ignore');
  pckry.ignore( ignorableElem );
  pckry.layout();

  var isIgnoring = true;
  
  eventie.bind( button, 'click', function() {
    // ignore or unignore element
    isIgnoring = !isIgnoring;
    // ignore and unignore are undocumented methods
    pckry[ isIgnoring ? 'ignore' : 'unignore' ]( ignorableElem );
    pckry.layout();
  });
});

            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console