你好,所以我做了在线课程,老师试图教我们一个像这样的气泡动画:https ://drinkcann.com/但更简单的是他只想让气泡动画但由于某种原因我的代码没有工作:
var numberOfbubbles = 10
for (let i = 0; i < numberOfbubbles; i++) {
newBubble()
}
function newBubble() {
let bubble= document.createElement("div");
bubble.classList.add("bubble");
let x = randomNumber(100);
let delay= randomNumber(3000)
bubble.style.left = x + "vw";
bubble.style.animationDelay = delay + "ms";
document.querySelector("body").appendChild(bubble);
}
function randomNumber() {
return Math.floor(Math.random() * max)
}
```
the html code has an html:5 standard and just a div so can you tell me where is the problem in my code?,let me know if you want to post something else too
css code: https://codeshare.io/5Nn8PJ