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

              
                <div class="wrapper">
		<div class="bar">
		  <div class="inner-bar">
        <p class="text"><span id="count">0 </span> of <span id="max"></span> items</p>	 
		  </div>  
		</div> 
</div>

 <div class="wrapper">
    <div class="plus">Plus</div>
    <div class="minus disabled">Minus</div>
</div>






              
            
!

CSS

              
                /* COLOR VARIABLES
============================================= */
$orange: #ffa600;
$grey: #e3e3e3;
$dark: #3e3e3e;
$white: #fff;
$blue: #82d2e5;
$green:#c1d72e;



/* MIXIN
============================================= */

@mixin fade {
	-moz-transition: all 1s ease-in;
	-moz-transition: all 0.3s ease-in-out;
	-webkit-transition: all 0.3s ease-in-out;
}



/* BUTTONS 
============================================= */

%btn {
	@include fade;
	padding: 15px 10px;
	color: $white;
	cursor: pointer;
	font-size: 24px;
	width: 150px;
	margin: 5px;
	text-align: center;
	float: left;
}

/* BUTTON MIXIN 
============================================= */
@mixin  btn-background($btn-background) {
	@extend %btn;
	background-color: $btn-background;
	
	&:hover {
	  background-color: lighten($btn-background,20% );
	  color:$grey;
	}
}

.plus,
.minus {
	@include btn-background($orange);
}

.plus.disabled, 
.minus.disabled {
	@include btn-background($grey);
}


/* LAYOUT
============================================= */

.wrapper {
  position: relative;
  overflow: hidden;
  width: 480px;
  margin: 0 auto;
}

/* TEXT
============================================= */
.text {
  font-size: 18px;
  font-weight: bold;
  left:120px;
  margin: 15px 0;
  width:100%;
  text-align: center;
}


/* BAR
============================================= */

.bar {
  width:300px;
  background:$grey;
  margin: 40px 30px;
}

.inner-bar {
  overflow: hidden;
  height: 50px;
	width: 100;
}

/* ANIMATION
============================================= */

@for $i from 1% through 100% {
  
  .inner-bar[data-width="#{$i}"] {
   @include fade;

  
background: $orange; /* Old browsers */
background: -moz-linear-gradient(left, $orange 0%, $orange #{$i}, $grey #{$i}, $grey 100%); /* FF3.6+ */
  
background: -webkit-gradient(linear, left top, right top, color-stop(0%,$orange), color-stop(#{$i},$orange), color-stop(#{$i},$grey), color-stop(100%,$grey)); /* Chrome,Safari4+ */

background: -webkit-linear-gradient(left, $orange 0%,$orange #{$i},$grey #{$i},$grey 100%); /* Chrome10+,Safari5.1+ */

background: -o-linear-gradient(left, $orange 0%,$orange #{$i},$grey #{$i},$grey 100%); /* Opera 11.10+ */

background: -ms-linear-gradient(left, $orange 0%,$orange #{$i},$grey #{$i},$grey 100%); /* IE10+ */

background: linear-gradient(to right, $orange 0%,$orange #{$i},$grey #{$i},$grey 100%); /* W3C */

filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='$orange', endColorstr='$grey',GradientType=1 ); /* IE6-9 */
  

    .text {
  
     
       
      color: $dark; //fallback
      
      background: -webkit-linear-gradient(left, $white 0%,$white 
         #{$i},$dark #{$i},$dark 100%); /* Chrome10+,Safari5.1+ */

       -webkit-background-clip: text;
       -webkit-text-fill-color: transparent;
    }

  }
}





              
            
!

JS

              
                $(document).ready(function () {
  
  var counter = document.getElementById('count');
  var max = document.getElementById('max');
  
  var count = 0;
  var maxCount = 20;

  max.innerHTML = maxCount;

  // Percentage function
  var percentage =  function () {
    var percent = (count / maxCount ) * 100;
    var width = parseInt (percent); 
    $(".inner-bar").attr('data-width', width +'%');
  }

  // Active Buttons functions
  var minus = function () {
    if ( count <= 0) {
    $(".minus").addClass( "disabled" );

     } else {
    $(".minus").removeClass( "disabled" );
   }
  }

  var plus = function () {
    if ( count >= maxCount) {
    $(".plus").addClass( "disabled" );

    } else {
    $(".plus").removeClass( "disabled" );
  }

  }

  $(".plus").click(function () { 
    if (count < maxCount) {
      count ++;
      counter.innerHTML = count;
      percentage (); 
      plus ();
      minus ();
    }    
  })
  
  $(".minus").click(function () {
    if ( count > 0) {
      count --;
      counter.innerHTML = count;
      percentage ();   
      minus ();
      plus ();
    } 
  }); 
  
  

   
  
  
});
 




              
            
!
999px

Console