例子有问题
<!DOCT html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>拖拽插件</title>
<style>
.fl{ float: left;}
.fr{ float: right;}
.drag{ width: 50px;height: 50px;background-color: green;margin: 10px;padding: 10px;color:#fff;cursor: move;}
.title{ width: 300px;background-color: pink;padding: 10px;font-weight: bold;}
.tip{ width: 300px;text-align: center;padding: 10px;}
.cart{ width: 300px;height: 100px;border: 1px solid #000; text-align: center;padding: 10px;}
.focus{ background-color: #ccc;}
</style>
<script type="text/javascript" src="js/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.9.2.min.js"></script>
</head>
<body>
<div class="wrapper">
<div id="divtest">
<div class="box">
<div class="title">产品区</div>
<div class="drag">
<div>青椒</div>
</div>
<div class="drag">
<div>黄瓜</div>
</div>
</div>
<div class="box">
<div class="title">购物车(<span>0</span>)</div>
<div class="cart">
<div class="tip">
还没有产品
</div>
</div>
</div>
</div>
</div>
<script type="text/javascript">
var intSum=0;
$(function(){
$('.drag').draggable();
$('.cart').droppable({
drop:function(){
intSum++;
$(this).addClass('focus').find('#tip').html('');
$('.title span').html(intSum);
}
})
});
</script>
</body>
</html>
从购物车再次放置一次就加一次,有什么解决办法吗