Browse Source

Change width/height code

master
Stephen 1 week ago
parent
commit
c500ed94e2
1 changed files with 10 additions and 6 deletions
  1. +10
    -6
      script.js

+ 10
- 6
script.js View File

@ -1,6 +1,7 @@
function addBee() {
const width = window.innerWidth;
const height = window.innerHeight;
const rect = document.body.getBoundingClientRect();
const width = rect.width;
const height = rect.height;
const body = document.body;
const bee = document.createElement("img");
bee.src = "bee.png";
@ -18,8 +19,9 @@ function addBee() {
}
window.onload = function() {
const width = window.innerWidth;
const height = window.innerHeight;
const rect = document.body.getBoundingClientRect();
const width = rect.width;
const height = rect.height;
const bees = document.getElementsByClassName("bee");
for(let i = 0; i < bees.length; i++) {
@ -32,8 +34,10 @@ window.onload = function() {
let i = 0;
setInterval(() => {
const beesNew = document.getElementsByClassName("bee");
const width = window.innerWidth;
const height = window.innerHeight;
const rect = document.body.getBoundingClientRect();
const width = rect.width;
const height = rect.height;
for(let j = 0; j < beesNew.length; j++) {
const bee = beesNew[j];
if(i % 250 == 0) {


Loading…
Cancel
Save