• 简单的js拖动


    window.onload = function () {
                var oDiv = document.getElementById("oDiv"); //oDiv必须使用CSS定位
                oDiv.onmousedown = drag;
                function drag(evt) {
                    evt = evt || window.event;
                    this.onmouseup = drop;
                    this.onmousemove = moveDiv;
                    this.offset = {
                        x: evt.offsetX,
                        y: evt.offsetY
                    };
                }
                function moveDiv(evt) {
                    evt = evt || window.event;
                    this.style.left = evt.clientX - this.offset.x + "px";
                    this.style.top = evt.clientY - this.offset.y + "px";
                }
                function drop(evt) {
                    this.onmouseup = null;
                    this.onmousemove = null;
                }
            };

  • 相关阅读:
    CentOS命令找不到
    Docker原理之rootfs
    Docker原理之Namespace
    Docker原理之Cgroups
    Docker目录
    Docker基本使用
    Linux命令之防火墙
    Linux命令目录
    Rancher之主机添加
    oracle-decode函数用法
  • 原文地址:https://www.cnblogs.com/xiexingen/p/2981540.html
Copyright © 2020-2023  润新知