e vor 1 Jahr
Ursprung
Commit
bc195f9719
6 geänderte Dateien mit 16 neuen und 0 gelöschten Zeilen
  1. 11 0
      day15/html/5.屏幕宽高.html
  2. BIN
      day15/img/1.png
  3. BIN
      day15/img/2.png
  4. BIN
      day15/img/3.png
  5. BIN
      day15/img/4.png
  6. 5 0
      day15/js/5.屏幕宽高.js

+ 11 - 0
day15/html/5.屏幕宽高.html

@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="UTF-8">
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <title>Document</title>
+</head>
+<body>
+    <script src="../js/5.屏幕宽高.js"></script>
+</body>
+</html>

BIN
day15/img/1.png


BIN
day15/img/2.png


BIN
day15/img/3.png


BIN
day15/img/4.png


+ 5 - 0
day15/js/5.屏幕宽高.js

@@ -0,0 +1,5 @@
+// 获取屏幕宽高
+var screenWidth = document.body.clientWidth || document.documentElement.clientWidth;
+var screenHeight = document.body.clientHeight || document.documentElement.clientHeight;
+console.log(screenWidth,'宽度');
+console.log(screenHeight,'高度');