仿百度首页登陆框拖拽效果(可视窗口内拖动)

分享一份由专业教师制作的人工智能教程,适合零基础学习者,内容通俗易懂,涵盖人工智能基础知识及实战技巧,助力个人技能提升。

分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.youkuaiyun.com/jiangjunshow

也欢迎大家转载本篇文章。分享知识,造福人民,实现我们中华民族伟大复兴!

                       

慕课网视频地址: http://www.imooc.com/learn/60

<!doctype html><html lang="en">    <head>        <meta charset="UTF-8" />        <title>Document</title>        <style type="text/css">            * {                padding: 0px;                margin: 0px;            }            html,            body {                font-size: 12px;                font-family: "微软雅黑";                width: 100%;                height: 100%;            }            .main {                text-align: right;                line-height: 20px;                margin-right: 40px;                color: red;            }            div.mask {                width: 100%;                height: 100%;                background: #000000;                opacity: 0.8;                position: absolute;                top: 0px;                left: 0px;                display: none;                z-index: 10;            }            .login {                display: none;                position: absolute;                background: white;                top: 0px;                left: 0px;                z-index: 11;                width: 391px;                border: 1px solid red;            }            .login a {                text-decoration: none;            }            .login .title {                height: 48px;                line-height: 48px;                color: black;                font-size: 16px;                border-bottom: 1px solid red;                background: #f5f5f5;                padding-left: 20px;                cursor: move;            }            .login .close {                width: 16px;                height: 16px;                position: absolute;                top: 15px;                right: 20px;                background: url(img/close_def.png) no-repeat center center;                border: 1px solid red;                cursor: pointer;            }            .login .close:hover {                background: url(img/close_hov.png) no-repeat center center;            }            .login .content {                padding: 10px 20px;            }            .login .content div {                padding-top: 15px;            }            .login .content div input {                width: 100%;                height: 40px;                border: 1px solid red;                font-size: 16px;                color: black;                text-indent: 35px;            }            .login .content div input[type='text'] {                background: url(img/input_username.png) no-repeat 3px 0px;            }            .login .content div input[type='password'] {                background: url(img/input_password.png) no-repeat 2px 0px;            }            .login .content div.now {                height: 40px;                padding: 0px;                line-height: 40px;                text-align: right;            }            .login .content div.sbm {                height: 50px;                padding: 0px;            }            .login .content div.sbm input {                background: #3b7ae3;                border: none;                font-size: 16px;                color: #fff;                border-radius: 5px;                display: block;            }        </style>        <script type="text/javascript">            window.onload = function() {                //获取函数对象                function G(id) {                    return document.getElementById(id);                }                function autocenter(el) {                    var bodyW = document.documentElement.clientWidth;                    var bodyH = document.documentElement.clientHeight;                    var elW = el.offsetWidth;                    var elH = el.offsetHeight;                    el.style.left = (bodyW - elW) / 2 + "px";                    el.style.top = (bodyH - elH) / 2 + "px";                }                var mouseoffsetX = 0;                var mouseoffsetY = 0;                var isdrag = false;                G('title').onmousedown = function(e) {                    var e = e || window.event;                    mouseoffsetX = e.pageX - G('login').offsetLeft;                    mouseoffsetY = e.pageY - G('login').offsetTop;                    isdrag = true; //可拖动标志位                };                document.onmousemove = function() {                    var e = e || window.event;                    var mouseX = e.pageX; //鼠标当前位置                    var mouseY = e.pageY;                    var moveX = 0; //鼠标新位置                    var moveY = 0;                    if(isdrag == true) {                        moveX = mouseX - mouseoffsetX;                        moveY = mouseY - mouseoffsetY;                        //范围限定 moveX>0&&moveX<(页面宽度-浮层宽度)                        //范围限定 moveY>0&&moveX<(页面高度-浮层高度)                        var bodyW = document.documentElement.clientWidth;                        var bodyH = document.documentElement.clientHeight;                        var elW = G('login').offsetWidth;                        var elH = G('login').offsetHeight;                        var maxX = bodyW - elW; //left最大值                        var maxY = bodyH - elH; //top最大值                        moveX = Math.min(maxX, Math.max(0, moveX)); //这两句是精华                        moveY = Math.min(maxY, Math.max(0, moveY));                        G('login').style.left = moveX + "px";                        G('login').style.top = moveY + "px";                    }                }                document.onmouseup = function() {                    isdrag = false;                }                G('lg').onclick = function() {                    G('mask').style.display = "block";                    G('login').style.display = "block";                    autocenter(G('login'));                }                G('close').onclick = function() {                    G('mask').style.display = "none";                    G('login').style.display = "none";                }                window.onresize = function() {                    autocenter(G('login'));                }            }        </script>    </head>    <body onselectstart="return false">        <div class="main">            <a href="##" id="lg">登录</a>        </div>        <div class="mask" id="mask"></div>        <div id="login" class="login">            <div class="title" id="title">                <span>立即登陆</span>                <a class="close" id="close"></a>            </div>            <div class="content">                <div class="user_name">                    <input type="text" value="" placeholder="注册用户名" />                </div>                <div class="pwd">                    <input type="password" value="" placeholder="登陆密码" />                </div>                <div class="now">                    <a href="#">忘记密码</a>                </div>                <div class="sbm">                    <input type="submit" value="登陆" />                </div>                <div class="now">                    <a href="#">立即注册</a>                </div>            </div>        </div>    </body></html>
  
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180
  • 181
  • 182
  • 183
  • 184
  • 185
  • 186
  • 187
  • 188
  • 189
  • 190
  • 191
  • 192
  • 193
  • 194
  • 195
  • 196
  • 197
  • 198
  • 199
  • 200
  • 201
  • 202
  • 203
  • 204
  • 205
  • 206
  • 207
  • 208
  • 209
  • 210
  • 211
  • 212
  • 213
  • 214
  • 215
  • 216
  • 217
  • 218
  • 219
  • 220
  • 221
  • 222
  • 223
  • 224
  • 225
  • 226
           

给我老师的人工智能教程打call!http://blog.youkuaiyun.com/jiangjunshow
这里写图片描述
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值