帖子
帖子
用户
博客
课程
显示全部楼层
2
帖子
0
勋章
7
Y币

[App引擎] 求助。拖动的实现,预览可以,但在真机调试不行

[复制链接]
发表于 2015-7-30 17:22:10
<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>APP</title>
    <link rel="stylesheet" type="text/css" href="../css/api.css" />
    <link rel="stylesheet" type="text/css" href="../css/common.css" />
                <style>
                        #big {
                                border: 1px solid #FF3300;
                                width: 300px;
                                height: 300px;
                                position: relative;
                        }
                        #small {
                                background: #99CC00;
                                width: 50px;
                                height: 50px;
                                position: absolute;
                                cursor: move;
                        }
                </style>
                <script type="text/javascript">
                        function small_down(e) {
                                var obig = document.getElementById("big");
                                var osmall = document.getElementById("small");
                                var e = e || window.event;
                                document.onmousemove = small_move;
                                document.onmouseup = small_up;
                                osmall.startX = e.clientX - osmall.offsetLeft;
                                osmall.startY = e.clientY - osmall.offsetTop;
                        }

                        function small_move(e) {
                                var obig = document.getElementById("big");
                                var osmall = document.getElementById("small");
                                var e = e || window.event;
                                osmall.style.left = e.clientX - osmall.startX + "px";
                                osmall.style.top = e.clientY - osmall.startY + "px";
                                if (e.clientX - osmall.startX <= 0) {
                                        osmall.style.left = 0 + "px";
                                }
                                if (e.clientY - osmall.startY <= 0) {
                                        osmall.style.top = 0 + "px";
                                }
                                if (e.clientX - osmall.startX >= 250) {
                                        osmall.style.left = 250 + "px";
                                }
                                if (e.clientY - osmall.startY >= 250) {
                                        osmall.style.top = 250 + "px";
                                }
                        }

                        function small_up() {
                                document.onmousemove = "";
                                document.onmouseup = "";
                        }
                       
                       
                       
                </script>
        </head>
        <body>
                <div id= "big">
                        <div id="small"></div>
                </div>
        </body>
</html>

5
帖子
0
勋章
1万+
Y币
css都提交到云端了吗,先别加密
2
帖子
0
勋章
7
Y币
技术支持-M 发表于 2015-7-30 17:30
css都提交到云端了吗,先别加密

本地真机调试不行
您需要登录后才可以回帖 登录

本版积分规则