|
@@ -0,0 +1,56 @@
|
|
|
|
+<!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: 100px;
|
|
|
|
+ height: 100px;
|
|
|
|
+ background-color: red;
|
|
|
|
+ position: absolute;
|
|
|
|
+ top: 0;
|
|
|
|
+ left: 0;
|
|
|
|
+ }
|
|
|
|
+ .box2{
|
|
|
|
+ width: 200px;
|
|
|
|
+ height: 200px;
|
|
|
|
+ background-color: blue;
|
|
|
|
+ position: absolute;
|
|
|
|
+ top: 0;
|
|
|
|
+ left: 0;
|
|
|
|
+ }
|
|
|
|
+ </style>
|
|
|
|
+</head>
|
|
|
|
+<body>
|
|
|
|
+ <div class="box2"></div>
|
|
|
|
+ <div class="box"></div>
|
|
|
|
+
|
|
|
|
+ <script>
|
|
|
|
+ let oBox = document.querySelector('.box');
|
|
|
|
+ let oBox2 = document.querySelector('.box2');
|
|
|
|
+
|
|
|
|
+ oBox.addEventListener("touchstart",function(){
|
|
|
|
+ this.style.display = 'none';
|
|
|
|
+ })
|
|
|
|
+ oBox2.addEventListener("click",function(){
|
|
|
|
+ console.log("click")
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ // oBox.onclick = function(){
|
|
|
|
+ // console.log('click');
|
|
|
|
+ // }
|
|
|
|
+ // oBox.addEventListener("touchstart",function(){
|
|
|
|
+ // console.log('点击');
|
|
|
|
+ // })
|
|
|
|
+ // oBox.addEventListener("touchmove",function(){
|
|
|
|
+ // console.log('滑动');
|
|
|
|
+ // })
|
|
|
|
+ // oBox.addEventListener("touchend",function(){
|
|
|
|
+ // console.log('离开');
|
|
|
|
+ // })
|
|
|
|
+
|
|
|
|
+ </script>
|
|
|
|
+</body>
|
|
|
|
+</html>
|