拖拽层1.0-创新互联

创新互联建站服务项目包括汕尾网站建设、汕尾网站制作、汕尾网页制作以及汕尾网络营销策划等。多年来,我们专注于互联网行业,利用自身积累的技术优势、行业经验、深度合作伙伴关系等,向广大中小型企业、政府机构等提供互联网行业的解决方案,汕尾网站推广取得了明显的社会效益与经济效益。目前,我们服务的客户以成都为中心已经辐射到汕尾省份的部分城市,未来相信会继续扩大服务区域并继续获得客户的支持与信任!le>.mdiv { position: absolute; border: 1px solid rgba(128, 128, 128, 1); width: 280px; cursor: pointer } .head { background-color: rgba(204, 204, 204, 1); width: 100%; height: 45px; text-align: center; line-height: 45px } .body { width: 100%; height: 235px; background-color: rgba(255, 255, 255, 1) } .moveDiv { border: 2px dashed rgba(204, 204, 204, 1) } 我可以拖动哦!   我可以拖动哦!   我可以拖动哦!   我可以拖动哦!  
      
        .mdiv
{
            position: absolute;
            border: #808080 solid 1px;
            width: 280px;
            cursor: pointer;   }

        .head
{
            background-color: #ccc;
            width: 100%;
            height: 45px;
            text-align: center;
            line-height: 45px;   }
        .body
{
            width: 100%;
            height: 235px;
            background-color:#ffffff;   }

        .moveDiv
{
            border: dashed 2px #ccc;   }         var DrgnMove= function (_head, _obj, mode) {
var head= $(_head);
var obj= $(_obj);
var d_x, d_y= 0;
var moveObj;
if (mode== 1) {
                obj.on("mousedown",function (e) {
                    e= e|| window.event;
                    moveObj= obj.clone();
                    moveObj.css("border","dashed #808080 2px").appendTo("body");
                    d_x= e.clientX- $(obj).offset().left;
                    d_y= e.clientY- $(obj).offset().top;
if (document.body.setCapture) {
                        document.body.onmousemove= move;
                        document.body.onmouseup= end;
                        document.body.setCapture;
                    }else {
                        document.addEventListener("mousemove", move,false);
                        document.addEventListener("mouseup", end,false);
                    }
                });
var move= function (e) {
                    e= window.event|| e;
                    moveObj.css({"left": e.clientX- d_x,"top": e.clientY- d_y });
                    window.getSelection? window.getSelection().removeAllRanges() : document.selection.empty();//防止选择文字                };
var end= function () {
if (document.body.setCapture) {
                        document.body.onmousemove= null;
                        document.body.onmouseup= null;
                        document.body.setCapture;
                    }else {
                        document.removeEventListener("mousemove", move,false);
                        document.removeEventListener("mouseup", end,false);
                    }
                    obj.css({"left": moveObj.css("left"),"top": moveObj.css("top") });
                    moveObj.remove();
                }
            }else {
                obj.on("mousedown",function (e) {
                    e= e|| window.event;
                    d_x= e.clientX- $(obj).offset().left;
                    d_y= e.clientY- $(obj).offset().top;
if (document.body.setCapture) {
                        document.body.onmousemove= move;
                        document.body.onmouseup= end;
                        document.body.setCapture;
                    }else {
                        document.addEventListener("mousemove", move,false);
                        document.addEventListener("mouseup", end,false);
                    }
                });
var move= function (e) {
                    e= window.event|| e;
                    obj.css({"left": e.clientX- d_x,"top": e.clientY- d_y });
                    window.getSelection? window.getSelection().removeAllRanges() : document.selection.empty();//防止选择文字                };
var end= function () {
if (document.body.setCapture) {
                        document.body.onmousemove= null;
                        document.body.onmouseup= null;
                        document.body.setCapture;
                    }else {
                        document.removeEventListener("mousemove", move,false);
                        document.removeEventListener("mouseup", end,false);
                    }
                }
            }
        }

        $(function () {
            DrgnMove("#mHead","#mobj",1);
            DrgnMove("#Div2","#Div1",2);
            DrgnMove("#Div4","#Div3",2);
            DrgnMove("#Div6","#Div5",2);
        });
    
   
           我可以拖动哦!
我可以拖动哦!
我可以拖动哦! 我可以拖动哦!
当前文章:拖拽层1.0-创新互联
地址分享:http://azwzsj.com/article/dcihos.html

其他资讯