How to addClass and removeClass with every item that gets dragged and dropped?
Hello guys,
I would like to show a different background image every time I drop a draggable into the drop area. With this in place I can give the illusion that a bag is getting full.
This is what I have so far:
- $basket.droppable({
- drop: function(event, ui) {
- var $milkItem = $('#milk');
- var $milkItem2 = $('#milk2');
- var $milkItem3 = $('#milk3');
-
- if ($milkItem.is('li#milk')){
- $(this).removeClass('plain').addClass('plain2').end();
- }else if ($milkItem2.is('#milk2')){
- $(this).removeClass('plain2').addClass('plain3');
- }
- return false;
- }
- });
Can someone point me in the right direction.
I would also like to add dollar values to those items and have them add up.
Thanks