zoukankan      html  css  js  c++  java
  • 增加弹出层的拖拽功能

    //背景层加入页面
    //以下部分实现弹出层的拖拽效果
    var posX;
    var posY;
    Idiv.onmousedown=function(e)
    {
    if(!e) e = window.event; //IE
    posX = e.clientX - parseInt(Idiv.style.left);
    posY = e.clientY - parseInt(Idiv.style.top);
    document.onmousemove = mousemove;
    }
    document.onmouseup = function()
    {
    document.onmousemove = null;
    }
    function mousemove(ev)
    {
    if(ev==null) ev = window.event;//IE
    Idiv.style.left = (ev.clientX - posX) + "px";
    Idiv.style.top = (ev.clientY - posY) + "px";
    }
     
    }
    function closeDiv() //关闭弹出层
    {
    var Idiv=document.getElementById("Idiv");
    Idiv.style.display="none";
    document.body.style.overflow = "auto"; //恢复页面滚动条
    var body = document.getElementsByTagName("body");
    var mybg = document.getElementById("mybg");
    body[0].removeChild(mybg);
    }
  • 相关阅读:
    Python 函数 -range()
    Python 函数 -xrange()
    Python 函数 -globals()
    Python 函数-max()
    Python 函数 -hasattr()
    Python 函数 memoryview()
    Python函数 hash()
    QAQ
    Õ() Big-O-notation
    一道有趣的条件概率题
  • 原文地址:https://www.cnblogs.com/wangyhua/p/4050663.html
Copyright © 2011-2022 走看看