cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

            
              body
  ul(class="filter-option")
      li
        a( href="javaScript:void(0)" class="active" data-category="All".toLowerCase())= 'All'.toUpperCase()
      li
        a( href="javaScript:void(0)" data-category="PANDA".toLowerCase())= 'Panda'.toUpperCase()
      li
        a( href="javaScript:void(0)" data-category="dog".toLowerCase())= 'Dog'.toUpperCase()
      li
        a( href="javaScript:void(0)" data-category="cat".toLowerCase())= 'cat'.toUpperCase()
      

  div(class="slider-wrapper")
    ul(class="item-slider")
      - var category = ['panda', 'panda', 'panda', 'panda', 'panda', 'dog', 'dog', 'dog', 'dog', 'dog', 'cat', 'cat', 'cat', 'cat', 'cat'];
      - var imgs = ['img-1.jpg', 'img-2.jpg', 'img-3.jpg', 'img-4.jpg', 'img-5.jpg', 'img-6.jpg', 'img-7.jpg', 'img-8.jpg', 'img-9.jpg', 'img-10.jpg', 'img-11.jpg', 'img-12.jpg', 'img-13.jpg', 'img-14.jpg', 'img-15.jpg',];

      - for(a=0; a<imgs.length; a++)
        li(data-match=""+category[a]+"".toLowerCase())
          img(src="https://webtechball.files.wordpress.com/2017/11/"+imgs[a]+"")
    
    div(class="slider-controls")
      span(class="prevSlide")
        i(class="fa fa-long-arrow-left")
      span(class="nextSlide")
        i(class="fa fa-long-arrow-right")
            
          
!
            
              *
  padding: 0
  margin: 0

body
  font-family: 'Montserrat', sans-serif

.filter-option
  padding: 30px 0 0
  margin-bottom: 30px
  text-align: center
  li
    display: inline-block
    list-style: none
    + li
      margin-left: -5px
    a
      display: inline-block
      min-width: 150px
      font:
        size: 16px
        weight: 600
      color: #000
      text-decoration: none
      text-align: center
      background: transparent
      padding: 15px 0
      border-right: 1px solid #e5e5e6
      border-bottom: 2px solid #a9a9ab
      &.active
        background: #967540 
        color: #ffffff
        border-color: #80602d
    &:last-of-type
      a
        border-right: none   

.item-slider
  li
    margin: 0 15px
    img
      width: 100%

.slider-controls
  margin-top: 30px
  text-align: center
  span
    display: inline-block
    font-size: 20px
    width: 40px
    height: 40px
    line-height: 40px
    background: transparent
    border: 1px solid #8b6932
    color: #8b6932
    cursor: pointer
    margin: 0 5px
    transition: all 0.3s linear
    &:hover
      background: #8b6932
      color: #ffffff
      border-color: #8b6932
    
            
          
!
            
              $(document).ready(function(){
  "use strict";
  
  //------- Initialising Slick Slider
  $('.item-slider').slick({
    arrows: false,
    cssEase: 'cubic-bezier(0.7, 0, 0.3, 1)',
    slidesToShow: 4,
    responsive: [
    {
      breakpoint: 1024,
      settings: {
        slidesToShow: 3
      }
    },
    {
      breakpoint: 900,
      settings: {
        slidesToShow: 2
      }
    },
    {
      breakpoint: 480,
      settings: {
        slidesToShow: 1
      }
    }
  ]
  });
  
  //------- Custom Arrows click functionality
  $(document).on('click', '.prevSlide', function(){
    $('.item-slider').slick('slickPrev');
  });
  
  $(document).on('click', '.nextSlide', function(){
    $('.item-slider').slick('slickNext');
  });
  
  //------- Click to filter slides according to user's choice
  
  $(document).on('click', '.filter-option li a', function(){
      $('.filter-option li a').removeClass('active');
        $(this).addClass('active');

        var cat = $(this).attr('data-category');

        if(cat !== 'all'){
          $('.item-slider').slick('slickUnfilter');

          $('.item-slider li').each(function(){
            $(this).removeClass('slide-shown');
          });

          $('.item-slider li[data-match='+ cat +']').addClass('slide-shown');

          $('.item-slider').slick('slickFilter', '.slide-shown');
        }
    
        else{
          $('.item-slider li').each(function(){
            $(this).removeClass('slide-shown');
          });
          $('.item-slider').slick('slickUnfilter');
        }
      });
  
});
            
          
!
999px
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................

Console