123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
- <title>Document</title>
- <style>
- * {
- margin: 0;
- padding: 0;
- font-size: 0
- }
-
- .i {
- width: 200px;
- height: 200px;
- /* border: 1px solid orangered; */
- background-color: #000;
- /* float: left; */
- margin: 0;
- border: 0
- }
-
- .div {
- margin: 200px;
- width: 200px;
- padding: 100px;
- border: 1px solid black;
- position: relative;
- }
-
- .div2 {
- margin: 200px;
- width: 200px;
- padding: 100px;
- border: 1px solid black;
- float: left;
- }
- </style>
- </head>
- <body>
- <video src="./1.mp4" width="500" height="500" controls></video>
- <img src="./1_answer_a.png" alt="" class="i">
- <div class="div2">
- <div class="div">
- <div class="div">
- <img src="./1_answer_b.png" alt="" class="i" onclick="drag()">
- </div>
- </div>
- </div>
- <div class="div2">
- <div class="div2">
- <div class="div2">
- <img src="./1_answer_b.png" alt="" class="i" onclick="drag()">
- </div>
- </div>
- </div>
- </body>
- <script>
- function drag(e) {
- e = e || window.event;
- console.log(e.target);
- console.log(e.target.offsetLeft);
- console.log(getOffsetLeft(e.target));
- }
- function getOffsetLeft(obj) {
- let tmp = obj.offsetLeft;
- let val = obj.offsetParent;
- while (val != null) {
- tmp += val.offsetLeft;
- val = val.offsetParent;
- }
- return tmp;
- };
- let arr = [
- [0, 1, 1],
- [1, 1, 0],
- [1, 0, 0]
- ]
- [
- [1, null, null],
- [0, 0, 1],
- [1, null, null]
- ]
- [
- [1, 0, 1],
- [1, 0, 1],
- [0, 1, 0]
- ]
- function isOk(arr) {
- let total = 0
- for (var i = 0; i < arr.length; i++) {
- // if(){
- // }
- total += i;
- }
- console.log(i)
- }
- </script>
- </html>
|