
获得徽章 0
冬天了,怎么让电脑帮暖手
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>加热</title>
<style>
*{
margin: 0;
padding: 0;
}
#hot{
transform: translate3d(0px,0px,0px);
opacity: 0.99;
display: inline-block;
}
</style>
</head>
<body>
<div id="hot">用于电脑加热</div>
<script>
let hotHtml = document.getElementById("hot")
let count = 0
let dir = false
setInterval(()=>{
let max = window.innerWidth - hotHtml.offsetWidth
if(count>=max) {
dir=true
} else if(count <= 0) {
dir = false
}
if(dir) {
count--
} else {
count++
}
hotHtml.style.transform = `translate3d(${count}px,0px,0px)`
},0)
</script>
</body>
</html>
请大佬来改
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>加热</title>
<style>
*{
margin: 0;
padding: 0;
}
#hot{
transform: translate3d(0px,0px,0px);
opacity: 0.99;
display: inline-block;
}
</style>
</head>
<body>
<div id="hot">用于电脑加热</div>
<script>
let hotHtml = document.getElementById("hot")
let count = 0
let dir = false
setInterval(()=>{
let max = window.innerWidth - hotHtml.offsetWidth
if(count>=max) {
dir=true
} else if(count <= 0) {
dir = false
}
if(dir) {
count--
} else {
count++
}
hotHtml.style.transform = `translate3d(${count}px,0px,0px)`
},0)
</script>
</body>
</html>
请大佬来改
展开
1
5
赞了这篇文章