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.

Quick-add: + add another resource

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.

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.

            
                <!-- Demo Content -->
  <div class="container">

    <h1>MixItUp: Input Search</h1>
    
    <button class="filter" data-filter="all">All</button>
    <button class="filter" data-filter=".blue">Blue</button>
    <button class="filter" data-filter=".orange">Orange</button>
    <button class="filter" data-filter=".red">Red</button>
    
    <input type="text" id="input" placeholder="Type here">

    <hr>
    <div class="mix blue">
      <p class="title">Red</p>
    </div>
    <div class="mix red">
      <p class="title">Reddit</p>
    </div>
    <div class="mix orange">
      <p class="title">Orange</p>
    </div>
    <div class="mix red">
      <p class="title">Blue</p>
    </div>
    <div class="mix orange">
      <p class="title">Red Rover</p>
    </div>
    <div class="mix blue">
      <p class="title">Ed</p>
    </div>
  </div>
            
          
!
            
              * {
  box-sizing: border-box;
}

.container {
  width: 75%;
  margin: 5em auto;
}

.mix {
  display: none;
  text-align: center;
  width: 23%;
  margin: 1em 1%;
  background-color: #ccc;
}

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

.orange {
  background-color: orange;
}

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

button {
  background: #666666;
  border: none;
  color: white;
  padding: .65em;
  border-radius: 5px;
}

input {
  padding: .5em;
}

.title {
  font-weight: 2em;
}
            
          
!
            
              $(function() {

  $(".container").mixItUp();

  var inputText;
  var $matching = $();

  // Delay function
  var delay = (function(){
    var timer = 0;
    return function(callback, ms){
      clearTimeout (timer);
      timer = setTimeout(callback, ms);
    };
  })();

  $("#input").keyup(function(){
    // Delay function invoked to make sure user stopped typing
    delay(function(){
      inputText = $("#input").val().toLowerCase();
      
      // Check to see if input field is empty
      if ((inputText.length) > 0) {            
        $( '.mix').each(function() {
          $this = $("this");
          
           // add item to be filtered out if input text matches items inside the title   
           if($(this).children('.title').text().toLowerCase().match(inputText)) {
            $matching = $matching.add(this);
          }
          else {
            // removes any previously matched item
            $matching = $matching.not(this);
          }
        });
        $(".container").mixItUp('filter', $matching);
      }

      else {
        // resets the filter to show all item if input is empty
        $(".container").mixItUp('filter', 'all');
      }
    }, 200 );
  });
})
            
          
!
999px
Loading ..................

Console