修复进度条

main
AviderMin 3 weeks ago
parent 70e18672b9
commit baf744b33d

@ -45,12 +45,8 @@
</div>
<div class="footer">web新闻网站</div>
<script>
let totalHight = document.body.scrollHeight - window.innerHeight
const Prostick = document.querySelector('.Prostick')
window.addEventListener('scroll', function () {
let pro = (window.pageYOffset / totalHight) * 100
Prostick.style.width = pro + '%'
})
// let totalHight = document.body.scrollHeight - window.innerHeight
document.addEventListener("DOMContentLoaded", function () {
let imgs = [];
const carouselImages = document.querySelector('.banner img');
@ -72,8 +68,13 @@
li.textContent = item.text;
liContent.appendChild(li);
});
totalHight = document.body.scrollHeight - window.innerHeight;
});
const Prostick = document.querySelector('.Prostick')
window.addEventListener('scroll', function () {
let pro = (window.pageYOffset / totalHight) * 100;
Prostick.style.width = pro + '%';
})
</script>
</body>

Loading…
Cancel
Save