fengchuanyu há 2 semanas atrás
pai
commit
7f8ac2bfea

+ 1 - 1
4-BOM&DOM/练习8_移动正方形.html

@@ -29,7 +29,7 @@
             // 第三步给页面绑定移动事件
             oPage.onmousemove = function(e){
                 oBox.style.top = (e.clientY - y)+ "px";
-                oBox.style.left = (e.clientX - x)+ "px";
+                oBox.style.left = (e.clientX - x )+ "px";
             }
         }
         // 第四步移除页面移动事件

+ 54 - 0
4-BOM&DOM/练习9_DOM放大镜.html

@@ -0,0 +1,54 @@
+<!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;
+        }
+        .small-img{
+            width: 400px;
+            height: 400px;
+            position: relative;
+            float: left;
+        }
+        .small-img img{
+            width: 100%;
+            height: 100%;
+        }
+        .small-img .mask{
+            width: 200px;
+            height: 200px;
+            background-color: rgba(255,255,255,0.5);
+            position: absolute;
+            top: 0;
+            left: 0;
+        }
+        .big-img{
+            width: 400px;
+            height: 400px;
+            float: left;
+            overflow: hidden;
+            margin-left: 20px;
+        }
+        .big-img img{
+            width: 800px;
+            height: 800px;
+        }
+    </style>
+</head>
+<body>
+    <div class="container">
+        <div class="small-img">
+            <img src="./image/niu.png" alt="img">
+            <div class="mask"></div>
+        </div>
+        <div class="big-img">
+            <img src="./image/niu.png" alt="img">
+        </div>
+    </div>
+</body>
+</html>