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

              
                    <main id="app" class="flex-shrink-0">
      <div class="container">

        <div class="row mt-4 mb-4 justify-content-lg-center bg-light p-2 rounded">
          <div class="text-center p-4">
            <div class="form-check form-check-inline" v-for="item in category">
              <input class="form-check-input" type="checkbox" :value="item.no" v-model="checked" >
              <label class="form-check-label" for="flexCheckDefault">
                {{item.title}}
              </label>
            </div>
          </div>
        </div>

        <div id="box" v-show="isShow">
          <div v-for="(item, index) in getItems" class="card" ref="waterfall" style="width: 180px;">
            <svg class="bd-placeholder-img card-img-top" 
                 width="100%" 
                 height="180" 
                 focusable="false"><title>Placeholder</title><rect width="100%" height="100%" fill="#868e96"></rect><text x="50%" y="50%" fill="#dee2e6" dy=".3em">Image cap {{item.id}}</text></svg>
            <div class="card-body">
              <h5 class="card-title">Card title {{item.id}}</h5>
              <p class="card-text">category:{{item.category}}</p>
              <p class="card-text">{{item.text}}</p>
            </div>
          </div>
        </div> 
        
      </div>
    </main>  

    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1" crossorigin="anonymous">

    <script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.6.10/vue.min.js"></script>
    <script src="https://code.jquery.com/jquery-1.11.0.min.js"></script>
    <script src="https://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
    <script src="https://linzap.github.io/waterfall/waterfall-light.js"></script>
              
            
!

CSS

              
                
              
            
!

JS

              
                new Vue({
      el: '#app',
      data: {
        isShow: false,
        checked: [],
        category: [
          {no:1, title:'category:1'},
          {no:2, title:'category:2'},
          {no:3, title:'category:3'},
          {no:4, title:'category:4'},
          {no:5, title:'category:5'},
        ],
        items: [
            {id:1, category:1, text:'Some quick example text to bue bulk of the cards content.'},
            {id:2, category:5, text:'Some quick example text to build on the card title and make up tntent.'},
            {id:3, category:2, text:'Some quick example text to build on the card title and mak title and make up  title and make up  title and make up e up the bulk of the cards content.'},
            {id:4, category:4, text:'Some quick example text to build on the card title and makthe cards content.'},
            {id:5, category:2, text:'Some quick example text ulk of the cards content.'},
            {id:6, category:3, text:'Some quick example text to build on the card title and make up the bulk of the c title and make up  title and make up  title and make up ards content.'},
            {id:7, category:4, text:'Some quick example text to build on the card title and make u title and make up  title and make up p the bulk of the cards content.'},
            {id:8, category:3, text:'Some quick example text to build on the card title and make up the bulk of the cards content.'},
            {id:9, category:1, text:'Some quick example text to build on the card title and make up the bulk of the cards content.'},
            {id:10, category:4, text:'Some quick example text to build on the card title and make up the bulk of th title and make up e cards content.'},
            {id:11, category:3, text:'Some quick example text to build on the card title and make up the bulk of the cards content.'},
            {id:12, category:2, text:'Some quick example text to build on the card title and make up th title and make up  title and make up  title and make up e bulk of the cards content.'},
            {id:2, category:1, text:'Some quick example text to build on the card title and make up tntent.'},
            {id:3, category:2, text:'Some quick example text to build on the card title and mak title and make up  title and make up  title and make up e up the bulk of the cards content.'},
            {id:4, category:4, text:'Some quick example text to build on the card title and makthe cards content.'},
            {id:5, category:2, text:'Some quick example text ulk of the cards content.'},
            {id:6, category:3, text:'Some quick example text to build on the card title and make up the bulk of the c title and make up  title and make up  title and make up ards content.'},
            {id:7, category:4, text:'Some quick example text to build on the card title and make u title and make up  title and make up p the bulk of the cards content.'},
            {id:8, category:3, text:'Some quick example text to build on the card title and make up the bulk of the cards content.'},
            {id:9, category:1, text:'Some quick example text to build on the card title and make up the bulk of the cards content.'},
            {id:10, category:4, text:'Some quick example text to build on the card title and make up the bulk of th title and make up e cards content.'},
            {id:11, category:3, text:'Some quick example text to build on the card title and make up the bulk of the cards content.'},
            {id:12, category:2, text:'Some quick example text to build on the card title and make up th title and make up  title and make up  title and make up e bulk of the cards content.'},
            {id:2, category:1, text:'Some quick example text to build on the card title and make up tntent.'},
            {id:3, category:2, text:'Some quick example text to build on the card title and mak title and make up  title and make up  title and make up e up the bulk of the cards content.'},
            {id:4, category:4, text:'Some quick example text to build on the card title and makthe cards content.'},
            {id:5, category:2, text:'Some quick example text ulk of the cards content.'},
            {id:6, category:3, text:'Some quick example text to build on the card title and make up the bulk of the c title and make up  title and make up  title and make up ards content.'},
            {id:7, category:4, text:'Some quick example text to build on the card title and make u title and make up  title and make up p the bulk of the cards content.'},
            {id:8, category:3, text:'Some quick example text to build on the card title and make up the bulk of the cards content.'},
            {id:9, category:1, text:'Some quick example text to build on the card title and make up the bulk of the cards content.'},
            {id:10, category:4, text:'Some quick example text to build on the card title and make up the bulk of th title and make up e cards content.'},
            {id:11, category:3, text:'Some quick example text to build on the card title and make up the bulk of the cards content.'},
            {id:12, category:2, text:'Some quick example text to build on the card title and make up th title and make up  title and make up  title and make up e bulk of the cards content.'},
            {id:2, category:1, text:'Some quick example text to build on the card title and make up tntent.'},
            {id:3, category:2, text:'Some quick example text to build on the card title and mak title and make up  title and make up  title and make up e up the bulk of the cards content.'},
            {id:4, category:4, text:'Some quick example text to build on the card title and makthe cards content.'},
            {id:5, category:2, text:'Some quick example text ulk of the cards content.'},
            {id:6, category:3, text:'Some quick example text to build on the card title and make up the bulk of the c title and make up  title and make up  title and make up ards content.'},
            {id:7, category:4, text:'Some quick example text to build on the card title and make u title and make up  title and make up p the bulk of the cards content.'},
            {id:8, category:3, text:'Some quick example text to build on the card title and make up the bulk of the cards content.'},
            {id:9, category:1, text:'Some quick example text to build on the card title and make up the bulk of the cards content.'},
            {id:10, category:4, text:'Some quick example text to build on the card title and make up the bulk of th title and make up e cards content.'},
            {id:11, category:3, text:'Some quick example text to build on the card title and make up the bulk of the cards content.'},
            {id:12, category:2, text:'Some quick example text to build on the card title and make up th title and make up  title and make up  title and make up e bulk of the cards content.'},
            {id:2, category:1, text:'Some quick example text to build on the card title and make up tntent.'},
            {id:3, category:2, text:'Some quick example text to build on the card title and mak title and make up  title and make up  title and make up e up the bulk of the cards content.'},
            {id:4, category:4, text:'Some quick example text to build on the card title and makthe cards content.'},
            {id:5, category:2, text:'Some quick example text ulk of the cards content.'},
            {id:6, category:3, text:'Some quick example text to build on the card title and make up the bulk of the c title and make up  title and make up  title and make up ards content.'},
            {id:7, category:4, text:'Some quick example text to build on the card title and make u title and make up  title and make up p the bulk of the cards content.'},
            {id:8, category:3, text:'Some quick example text to build on the card title and make up the bulk of the cards content.'},
            {id:9, category:1, text:'Some quick example text to build on the card title and make up the bulk of the cards content.'},
            {id:10, category:4, text:'Some quick example text to build on the card title and make up the bulk of th title and make up e cards content.'},
            {id:11, category:3, text:'Some quick example text to build on the card title and make up the bulk of the cards content.'},
            {id:12, category:2, text:'Some quick example text to build on the card title and make up th title and make up  title and make up  title and make up e bulk of the cards content.'},
            {id:2, category:1, text:'Some quick example text to build on the card title and make up tntent.'},
            {id:3, category:2, text:'Some quick example text to build on the card title and mak title and make up  title and make up  title and make up e up the bulk of the cards content.'},
            {id:4, category:4, text:'Some quick example text to build on the card title and makthe cards content.'},
            {id:5, category:2, text:'Some quick example text ulk of the cards content.'},
            {id:6, category:3, text:'Some quick example text to build on the card title and make up the bulk of the c title and make up  title and make up  title and make up ards content.'},
            {id:7, category:4, text:'Some quick example text to build on the card title and make u title and make up  title and make up p the bulk of the cards content.'},
            {id:8, category:3, text:'Some quick example text to build on the card title and make up the bulk of the cards content.'},
            {id:9, category:1, text:'Some quick example text to build on the card title and make up the bulk of the cards content.'},
            {id:10, category:4, text:'Some quick example text to build on the card title and make up the bulk of th title and make up e cards content.'},
            {id:11, category:3, text:'Some quick example text to build on the card title and make up the bulk of the cards content.'},
            {id:12, category:2, text:'Some quick example text to build on the card title and make up th title and make up  title and make up  title and make up e bulk of the cards content.'},
        ]
      },
      computed: {
        getItems: function(){
          let self = this;
          return this.items.filter(function(item){
            return (
              self.checked.length === 0 || self.checked.indexOf(item.category) !== -1
            );
          });
        }
      },
      mounted:function() {		
        let self = this;
			  $('#box').waterfall({
            gap: 10,
            gridWidth: [0,400,600,800,1200],
            refresh: 0
        });
        setTimeout(function(){
          self.isShow = true;
        },0);
      },
      updated:function(){
        $('#box').waterfall({
            gap: 10,
            gridWidth: [0,400,600,800,1200],
            refresh: 500
        });
      }
    });
              
            
!
999px

Console