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.

            
              <div class="wrap">
  <p>ADD PRODUCTS</p>
  <div class="aggregator adding">
   
    <ul>
      <li>Cheese</li> 
      <li>Beer</li> 
      <li>Crackers</li> 
      <li>Pepperoni</li> 
      <li>Olives</li> 
    </ul>
  </div>

  <div class="cart">
    <div class="progress"><p></p></div>
   <!-- <h3>Products</h3>--><ul>

    </ul>
  </div>
</div>



            
          
!
            
              $easeOutQuad: cubic-bezier(0.250, 0.460, 0.450, 0.940); 

body {
  font-family: Vegur, Arial;
  background:#5c5c5c;
  color:#fff;
}
p {
  padding: 20px 0 0 14px;
}

.progress p {
  padding: 8px;
  color:#141309;
}

li {
  padding:10px;
  background: #4186a6;
  border: 1px solid #5c5c5c;
  position:relative;
  color:#141309;
}

.adding li:hover {
  background: #cc45c1;
}

/* Smartphones (portrait and landscape) ----------- */
@media only screen 
and (min-device-width : 320px) 
and (max-device-width : 480px) {
/* Styles */
  .adding li:hover {
  background: none;
  }
  .cart li:hover {
  background:none;
  }
}

.cart li:hover {
  background:#fad0d0;
}

.disabled {
  color: #666;
  background: #361f32;
}

li.disabled:hover {
  background: #361f32;
}

.added {
  float: right;
}

.plus {
 float:right;
  font-size:20px;
  font-weight:bold;
  color:#19FFB9;
}

.aggregator, .cart {
  margin: 10px 15px;
  width: 300px;
  background: #fff;
}

.wrap {
  margin: 0 auto;
  width: 400px;
}

.cart {
  width: 300px;
  background: #ffffff;
  border: 1px solid #ddd;
}

.cart ul li {
   background:#B9CDDF; 
}

.targetFlash {
    animation: 
    targetHit .5s 0s linear forwards,
}
/*thanks lea verou!*/
.progress {
  width: 0;
  background: 
    radial-gradient(circle at 100% 50%, transparent 20%, rgba(255,255,255,.3) 21%, rgba(255,255,255,.3) 34%, transparent 35%, transparent),
    radial-gradient(circle at 0% 50%, transparent 20%, rgba(255,255,255,.3) 21%, rgba(255,255,255,.3) 34%, transparent 35%, transparent) 0 -50px;
  background-color: #B9CDDF;
  background-size:15px 20px;
  transition: width .3s;
}

.tracer {
  border-radius: 30px;
  height:20px;
  width:20px;
  transition: all .3s ease-in;
  background: rgba(100, 100, 100, .3);
  position:absolute;
  top:0;
  z-index:100;
}

/*.moving {
  background:rgba(200, 200, 200, .5);
  z-index:100;
   animation:
     itemMove .5s 0 $easeOutQuad forwards,
}
*/

/*@keyframes itemMove {
  to {
    display:block;
    transform:translate3d(0,325px,0);
  }
}
*/
@keyframes targetHit {
  5%, 30% {
    background: #4186a6;
  }
  100% {
    background: #ffffff;
  }
}
            
          
!
            
              var i=0;
var prog=0;
$(".progress p").html(i +"/30 items");

/*$(function() {
    $( ".cart" ).accordion();
  });*/

$(".aggregator ul li").bind("click", function(){
  var clickedItem = $(this);
  $(".aggregator ul li").unbind("click");
  aggregator(clickedItem);
});

function aggregator(clickedItem) {
  if (clickedItem.hasClass("disabled")) {
    return;
  }
  else {
    //$(".aggregator ul li").off("click");
    clickedItem.html(clickedItem.html()+"<div class='tracer'></div>");
    var disabledText = clickedItem.html()+"<span class='added'>added</span>"; 
    clickedItem.addClass("disabled");
    clickedItem.html(disabledText);
    i++;
    moveTheDot();
    prog = prog +10;
    $('.progress').css("width", prog+"px");
    //clickedItem.clone().appendTo($(".cart ul"));
   
  }
}

//this works
/*$(".aggregator ul li").click(function () {
  if ($(this).hasClass("disabled")) {
    return;
  }
  else {
    //$(".aggregator ul li").off("click");
    $(this).html($(this).html()+"<div class='tracer'></div>");
    $(this).addClass("disabled");
    i++;
    moveTheDot();
  }
});
*/


//starts the tracer animation
var moveTheDot = function () {
  var origin = $(".tracer").offset();
  var destination = $(".cart").offset();
  var travel = destination.top-origin.top+"px"
  $(".tracer").css("top",travel);
  $(".tracer").bind("transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd", function(){  
    $(".tracer").remove();
    flashTheBox();
  });
}

//triggers the flash animation
var flashTheBox = function () {
    $(".cart").addClass("targetFlash");
    $('.targetFlash').bind( 'animationend webkitAnimationEnd', function() {
      $('.cart').removeClass("targetFlash");
      $(".progress p").html(i +"/30 items");
      //added touchstart for mobile
      $(document).on('click', '.aggregator ul li', function() {
      var clickedItem = $(this);
      aggregator(clickedItem);
    });                                                 
});         
}



            
          
!
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