fix all bugs

main
AviderMin 4 weeks ago
parent 185b579125
commit c4d30929f2

@ -64,13 +64,16 @@
</div>
<div class="footer">web新闻网站</div>
<script>
let totalHight;
let Prostick;
document.addEventListener("DOMContentLoaded", function () {
Prostick = document.querySelector('.Prostick');
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 + '%';

@ -42,6 +42,9 @@
</div>
<div class="footer">web新闻网站</div>
<script>
let totalHight;
let Prostick;
document.addEventListener("DOMContentLoaded", function () {
let imgs = [];
const carouselImages = document.querySelector('.banner img');
@ -63,25 +66,30 @@
li.textContent = item.text;
liContent.appendChild(li);
});
let newsinfo = [
{ text: "示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例" },
{ text: "示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例" },
{ text: "示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例" },
{ text: "很长很长的示例文本..." },
{ text: "另一个很长很长的示例文本..." },
{ text: "还有一个很长很长的示例文本..." },
];
const pContent = document.querySelector('.newsinfo');
newsInfo.forEach(item => {
newsinfo.forEach(item => {
const p = document.createElement('p');
p.textContent = item.text;
pContent.appendChild(p);
});
let totalHight = document.body.scrollHeight - window.innerHeight;
Prostick = document.querySelector('.Prostick');
totalHight = document.body.scrollHeight - window.innerHeight;
});
const Prostick = document.querySelector('.Prostick')
window.addEventListener('scroll', function () {
if (totalHight && Prostick) {
let pro = (window.pageYOffset / totalHight) * 100;
Prostick.style.width = pro + '%';
})
}
});
</script>
</body>

@ -47,13 +47,16 @@
</div>
<div class="footer">web新闻网站</div>
<script>
let totalHight;
let Prostick;
document.addEventListener("DOMContentLoaded", function () {
Prostick = document.querySelector('.Prostick');
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 + '%';

@ -27,13 +27,16 @@
<div class="searchicon"></div>
<div class="footer">web新闻网站</div>
<script>
let totalHight;
let Prostick;
document.addEventListener("DOMContentLoaded", function () {
Prostick = document.querySelector('.Prostick');
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 + '%';

Loading…
Cancel
Save