bailing 1 týždeň pred
rodič
commit
349617b2b5

+ 23 - 0
7.移动端/6.padding-top.html

@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>Document</title>
+    <style>
+        * {
+            margin: 0;
+            padding: 0;
+        }
+        #box {
+            width: 100px;
+            padding-top: 20vh;
+            /* height: 100px; */
+            background: #00f;
+        }
+    </style>
+</head>
+<body>
+    <div id="box"></div>
+</body>
+</html>

+ 39 - 0
7.移动端/7.touch.html

@@ -0,0 +1,39 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>Document</title>
+    <style>
+        #box{
+            width: 30vw;
+            height: 30vh;
+            background: plum;
+        }
+    </style>
+</head>
+<body>
+    <!-- 
+        touch:
+            click 200-300ms延迟
+    -->
+        <div id="box"></div>
+        <input type="text">
+        <script>
+            var box = document.querySelector("#box");
+            var input = document.querySelector("input");
+            box.ontouchstart = function(event) {
+                console.log("开始",event)
+            }
+            box.ontouchmove = function() {
+                console.log("移动")
+            }
+            box.ontouchend = function() {
+                console.log("离开")
+            }
+            input.onkeydown = function(event) {
+                console.log("开始",event)
+            }
+        </script>
+</body>
+</html>

+ 92 - 0
7.移动端/8.点透事件.html

@@ -0,0 +1,92 @@
+<!DOCTYPE html>
+<html lang="en">
+
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>Document</title>
+    <style>
+        * {
+            margin: 0;
+            padding: 0;
+        }
+
+        #box {
+            width: 100vw;
+            position: relative;
+        }
+
+        #under {
+            width: 90%;
+            height: 500px;
+            background: rgba(0, 0, 0, .1);
+            margin: 10px auto;
+            text-align: center;
+            line-height: 500px;
+            font-size: 25px;
+        }
+
+        #vase {
+            width: 80%;
+            height: 300px;
+            background: #fff;
+            position: absolute;
+            top: 100px;
+            left: 37px;
+            z-index: 9;
+        }
+        #close {
+            width: 100px;
+            height: 30px;
+            text-align: center;
+            line-height: 30px;
+            background: #00f;
+            color: #fff;
+            position: absolute;
+            top: 50%;
+            left: 50%;
+            margin-top: -15px;
+            margin-left: -50px;
+        }
+
+        #dialog {
+            width: 100%;
+            height: 100vh;
+            position: fixed;
+            top: 0;
+            left: 0;
+            background: rgba(0,0,0,.5);
+        }
+    </style>
+</head>
+
+<body>
+    <div id="box">
+        <div id="under">底层元素</div>
+        <div id="vase">
+            <div id="tit">弹出层</div>
+            <div id="close">关闭</div>
+        </div>
+        <div id="dialog"></div>
+    </div>
+    <script>
+        /**
+         * 点透事件:
+         * 1.两层元素叠加
+         * 2.第一层使用touch事件
+         * 3.第二层使用click事件/a标签
+        */
+        var close = document.getElementById("close");
+        var under = document.getElementById("under");
+        close.ontouchstart = function(event) {
+            event.preventDefault();
+            document.getElementById("vase").style.display = 'none';
+            document.getElementById("dialog").style.display = 'none';
+        }
+        under.onclick = function() {
+            alert("弹出")
+        }
+    </script>
+</body>
+
+</html>