Pen Settings

HTML

CSS

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.

+ 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

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.

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

              
                <h1>Filter Slick Slider</h1>
<p>This is a demo of slick slider filter functionality for an answer to a question on <a href="https://stackoverflow.com/questions/41104225/jquery-slick-slider-filtering-with-multiple-conditions/48519591#48519591">stackoverflow.com</a>.</p>
<form class="filter">
  <div class="filter-group">
    <h5>Color:</h5>
    <span class="color-filter" data-value="">All</span> |     
    <span class="color-filter" data-value=".black">black</span> |
    <span class="color-filter" data-value=".white">white</span> |
    <span class="color-filter" data-value=".green">green</span>
    
    <h5>Device:</h5>
    
      <span class="device-filter" data-value="">All</span> |
      <span class="device-filter" data-value=".phone">phone</span> |
      <span class="device-filter" data-value=".ipad">ipad</span> |
      <span class="device-filter" data-value=".tablet">tablet</span>
   
  </div>
</form>
<div class="active-filter">
  Active filter: <span class="filter-class">none</span>
</div>
<div class="slick">
    <div class="slide black phone">black phone</div>
    <div class="slide white phone">white phone</div>
    <div class="slide green phone">green phone</div>
    <div class="slide black ipad">black ipad</div>
    <div class="slide white ipad">white ipad</div>
    <div class="slide green ipad">green ipad</div>
    <div class="slide black tablet">black tablet</div>
    <div class="slide white tablet">white tablet</div>
    <div class="slide green tablet">green tablet</div>
</div>
              
            
!

CSS

              
                .green {
  background-color: green;
}

.black {
  background-color: black;
  color: white;
}

.white {
  background-color: white;
  color: black;
}

/** Just some styling to make it more readable. */


html {
  margin: 1rem;
}

.filter {
  margin: 1rem 0;
}

.active-filter {
  margin: 1rem 0;
}

.slick {
  width: 400px;
}

.slick .slide {
  width: 200px;
  height: 100px;
  padding: 1rem;
  border: 1px solid #808080;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}


              
            
!

JS

              
                $(function(){
  $('.slick').slick({
    slidesToShow: 3,
    slidesToScroll: 1,
    autoplay: true,
    autoplaySpeed: 2000,
    infinite: true,
  });
 
  
  $('form.filter span').on('click', function() {
    var filterClass = $(this).data('value');
    $('.filter-class').text(filterClass);
    $('.slick').slick('slickUnfilter');
    $('.slick').slick('slickFilter', filterClass);
  });
  
  
});

              
            
!
999px

Console