zoukankan      html  css  js  c++  java
  • 拖拽示例

    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/jquery-1.9.1.min.js"></script>
    </head>
    <body>
    <button class="button">开始</button>
    <button class="button">关闭</button>
    <button class="button">注册</button>

    <div id="con" style="500px;height:500px;background: yellow;margin-top: 100px"></div>
    <script>
    var moveItem=
    $(".button").bind("mousedown",function(event){
    $("#moveId").remove()
    moveItem= $(this).clone();
    moveItem.attr("id","moveId")
    $("body").append(moveItem)
    moveItem.css("left",event.clientX+2).css("top",event.clientY+2);
    moveItem.css("opacity","0.5").css("position","fixed").css("point-events","none");
    })
    $("#con").bind("mouseup",function(event){
    $(this).append(moveItem)
    moveItem.css("opacity","1").css("position","static");
    moveItem.attr("id","")
    moveItem.css("display","inline-block");
    })

    $(document).bind("mousemove",function(event){
    moveItem.css("left",event.clientX+2).css("top",event.clientY+2);
    })
    $(document).bind("mouseup",function(event){
    $("#moveId").remove()
    })
    </script>
    </body>
    </html>
  • 相关阅读:
    【docker】更换挂载目录
    【设计】交互走查表
    MySQL常用字符串函数
    VIM_manual
    MySQL操作符
    基础SELECT实例
    MySQL字符集及校对规则的理解
    Linux命令之tar-rsync
    Linux-PATH_环境变量
    MySQL常用数据类型
  • 原文地址:https://www.cnblogs.com/liuhao-web/p/10008854.html
Copyright © 2011-2022 走看看