index.html 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>Document</title>
  8. <style>
  9. * {
  10. margin: 0;
  11. padding: 0;
  12. font-size: 0
  13. }
  14. .i {
  15. width: 200px;
  16. height: 200px;
  17. /* border: 1px solid orangered; */
  18. background-color: #000;
  19. /* float: left; */
  20. margin: 0;
  21. border: 0
  22. }
  23. .div {
  24. margin: 200px;
  25. width: 200px;
  26. padding: 100px;
  27. border: 1px solid black;
  28. position: relative;
  29. }
  30. .div2 {
  31. margin: 200px;
  32. width: 200px;
  33. padding: 100px;
  34. border: 1px solid black;
  35. float: left;
  36. }
  37. </style>
  38. </head>
  39. <body>
  40. <video src="./1.mp4" width="500" height="500" controls></video>
  41. <img src="./1_answer_a.png" alt="" class="i">
  42. <div class="div2">
  43. <div class="div">
  44. <div class="div">
  45. <img src="./1_answer_b.png" alt="" class="i" onclick="drag()">
  46. </div>
  47. </div>
  48. </div>
  49. <div class="div2">
  50. <div class="div2">
  51. <div class="div2">
  52. <img src="./1_answer_b.png" alt="" class="i" onclick="drag()">
  53. </div>
  54. </div>
  55. </div>
  56. </body>
  57. <script>
  58. function drag(e) {
  59. e = e || window.event;
  60. console.log(e.target);
  61. console.log(e.target.offsetLeft);
  62. console.log(getOffsetLeft(e.target));
  63. }
  64. function getOffsetLeft(obj) {
  65. let tmp = obj.offsetLeft;
  66. let val = obj.offsetParent;
  67. while (val != null) {
  68. tmp += val.offsetLeft;
  69. val = val.offsetParent;
  70. }
  71. return tmp;
  72. };
  73. let arr = [
  74. [0, 1, 1],
  75. [1, 1, 0],
  76. [1, 0, 0]
  77. ]
  78. [
  79. [1, null, null],
  80. [0, 0, 1],
  81. [1, null, null]
  82. ]
  83. [
  84. [1, 0, 1],
  85. [1, 0, 1],
  86. [0, 1, 0]
  87. ]
  88. function isOk(arr) {
  89. let total = 0
  90. for (var i = 0; i < arr.length; i++) {
  91. // if(){
  92. // }
  93. total += i;
  94. }
  95. console.log(i)
  96. }
  97. </script>
  98. </html>