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 is required to process package imports. If you need a different preprocessor remove all packages first.

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

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

              
                <script src="https://unpkg.com/nouislider@10.0.0/distribute/nouislider.min.js"></script>
<link rel="stylesheet" href="https://unpkg.com/nouislider@10.0.0/distribute/nouislider.min.css">

<div class="filter-range">
			<div id="nonlinear" class="noUi-target noUi-ltr noUi-horizontal"></div>
			<span class="example-val" id="lower-value"></span>
			<span class="example-val" id="upper-value"></span>
</div>



<div class="boxes">
  <div class="box">
    <h2 class="title">Title Box 1</h2>
    <span class="price">145</span>
    <div class="stars">
      <div class="star">★</div>
      <div class="star">★</div>
    </div>
  </div>
  <div class="box">
    <h2 class="title">Title Box 2</h2>
    <span class="price">523</span>
    <div class="stars">
      <div class="star">★</div>
      <div class="star">★</div>
      <div class="star">★</div>
      <div class="star">★</div>
    </div>
  </div>
  <div class="box">
    <h2 class="title">Title Box 3</h2>
    <span class="price">175</span>
    <div class="stars">
      <div class="star">★</div>
    </div>
  </div>
  <div class="box">
    <h2 class="title">Title Box 4</h2>
    <span class="price">600</span>
    <div class="stars">
      <div class="star">★</div>
      <div class="star">★</div>
      <div class="star">★</div>
      <div class="star">★</div>
    </div>
  </div>
  <div class="box">
    <h2 class="title">Title Box 5</h2>
    <span class="price">320</span>
    <div class="stars">
      <div class="star">★</div>
      <div class="star">★</div>
      <div class="star">★</div>
    </div>
  </div>
</div>
              
            
!

CSS

              
                body
  font-family 'Indie Flower', cursive
  background-color tomato
  color #000
  
.box
  display block
  
  &.-close
    display none

.filter-range
  display flex
  justify-content space-between
  flex-flow wrap
  
  .noUi-horizontal
    width 100%

.stars
  display flex
              
            
!

JS

              
                var nonLinearSlider = document.getElementById('nonlinear');

noUiSlider.create(nonLinearSlider, {
	connect: true,
	behaviour: 'tap',
	start: [ 100, 600 ],
	range: {
		min: 100,
		max: 600
	}
});

var nodes = [
	document.getElementById('lower-value'), // 0
	document.getElementById('upper-value')  // 1
];

// Display the slider value and how far the handle moved
// from the left edge of the slider.
nonLinearSlider.noUiSlider.on('update', function ( values, handle, unencoded, isTap, positions ) {
	nodes[handle].innerHTML = values[handle];  
  verifyBoxes(values)
});


function verifyBoxes(v) {
  var boxesArr = [].slice.call(document.querySelectorAll(".box")).map(function(item){
      return item
  });

  for (var i =0; i < boxesArr.length; i++) {
    var box = boxesArr[i]
    var price = box.querySelector('.price').textContent
    var priceNumb = parseInt(price)
    var vMin = v[0]
    var vMax = v[1]
    
    if (priceNumb > vMax || priceNumb < vMin  ) {
        box.classList.add('-close') 
     } else {
       box.classList.remove('-close')
     }
  }
}

              
            
!
999px

Console