cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmlicon-personicon-teamoctocatpop-outspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

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.

            
              <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
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console