修复进度条

main
AviderMin 3 weeks ago
parent 70e18672b9
commit baf744b33d

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

Loading…
Cancel
Save