jquery-10-2放置插件问题

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <title>放置插件</title>
        <link href="style.css" rel="stylesheet" type="text/css" />
        <script src="http://www.imooc.com/data/jquery-1.8.2.min.js" type="text/javascript"></script>
        <script src="http://www.imooc.com/data/jquery-ui-1.9.2.min.js" type="text/javascript"></script>
    </head>
    
    <body>
        <div id="divtest">
            <div class="box">
                <div class="title">产品区</div>
                <div class="drag"><div>苹果</div></div>

            </div>
            <div class="box">
                <div class="title">回收站<span id="number"> (0)</span></div>
                <div class="cart"><div id="tip">还没有产品</div></div>
            </div>
        </div>
        
        <script type="text/javascript">
            $(function () {
                $(".drag").draggable();
                var intSum=0;
               
                var isInsert=false;
                $(".cart").droppable({
                    drop: function () {
                        if(isInsert){return;}else{isInsert = true;}
                            $(this).addClass('focus');
                            intSum++;
                            $("#tip").html("");
                            $("#number").html(" ("+intSum+")");

                        
                         },
                    out: function(){

                            intSum--; 

                           if(intSum == 0){ 

                              $(this).removeClass("focus").find("#tip").html("还没有产品");

                            }

                            $("#number").html(intSum);

                           isInsert=false;

}
                    
               
                            
                        
                })
            });
        </script>
    </body>
</html>

这个代码里面,当只有一个移动物体的时候,intNum的数量是正常显示的,但是当移动的物体有很多的时候,就不对了?

该怎么办呢

qq_蒋丹丹是枣糕少年_0
浏览 1100回答 1
1回答

MaxJin

把这行 <script src="http://www.imooc.com/data/jquery-1.8.2.min.js" type="text/javascript"></script>去掉
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JQuery