(084)jquery_jqueryui_droppable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
  <head>
    <title>droppable.html</title>
    
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="this is my page">
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    
    <!--<link rel="stylesheet" type="text/css" href="./styles.css">-->
    <style type="text/css">
        #divtest
        {
            width: 282px;
        }  
        .box
        {
            width: 280px;
            border: solid 1px #eee;
            margin: 10px 0px;
        }
        .box .title
        {
            padding: 8px;
            background-color: Blue;
            color: #fff;
            height: 23px;
            line-height: 23px;
            font-size: 15px;
            font-weight: bold;
        }
        .box .drag
        {
            padding: 5px;
            cursor: move;
        }
        .box .drag div
        {
            border: solid 1px #fff;
            background-color: red;
            color:#fff;
            cursor: move;
            width: 35px;
            padding: 20px;
            text-align: center;
        }
        .box .cart
        {
            padding: 5px;
            cursor: move;
        }
        .box .cart div
        {
            padding: 5px;
            height: 55px;
            text-align:center;
        }
        .focus
        {
            background-color: #eee;
        }
    </style>
    <script type="text/javascript" src="../js/jquery/jquery-1.8.3.min.js"></script>
    <script type="text/javascript" src="../js/jqueryui/jquery-ui-1.9.2.min.js"></script>
    <script type="text/javascript">
        $(function(){
            var sum = 0;
            $(".drag").draggable();
            $(".cart").droppable({
                drop:function(){
                    sum++;
                    $(this).addClass("focus");
                    $("#tip").html("");
                }
            });
        });
    </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">回收站</div>
                <div class="cart">
                    <div id="tip">还没有产品</div>
                </div>
            </div>
        </div>
  </body>
</html>

 

posted @ 2015-01-14 11:55  雪中飞雁  阅读(74)  评论(0)    收藏  举报