fix all bugs

main
AviderMin 3 weeks ago
parent 185b579125
commit c4d30929f2

@ -64,13 +64,16 @@
</div> </div>
<div class="footer">web新闻网站</div> <div class="footer">web新闻网站</div>
<script> <script>
let totalHight;
let Prostick;
document.addEventListener("DOMContentLoaded", function () { document.addEventListener("DOMContentLoaded", function () {
Prostick = document.querySelector('.Prostick');
totalHight = document.body.scrollHeight - window.innerHeight; totalHight = document.body.scrollHeight - window.innerHeight;
}); });
const Prostick = document.querySelector('.Prostick')
window.addEventListener('scroll', function () { window.addEventListener('scroll', function () {
let pro = (window.pageYOffset / totalHight) * 100; let pro = (window.pageYOffset / totalHight) * 100;
Prostick.style.width = pro + '%'; Prostick.style.width = pro + '%';

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

@ -47,13 +47,16 @@
</div> </div>
<div class="footer">web新闻网站</div> <div class="footer">web新闻网站</div>
<script> <script>
let totalHight;
let Prostick;
document.addEventListener("DOMContentLoaded", function () { document.addEventListener("DOMContentLoaded", function () {
Prostick = document.querySelector('.Prostick');
totalHight = document.body.scrollHeight - window.innerHeight; totalHight = document.body.scrollHeight - window.innerHeight;
}); });
const Prostick = document.querySelector('.Prostick')
window.addEventListener('scroll', function () { window.addEventListener('scroll', function () {
let pro = (window.pageYOffset / totalHight) * 100; let pro = (window.pageYOffset / totalHight) * 100;
Prostick.style.width = pro + '%'; Prostick.style.width = pro + '%';

@ -27,13 +27,16 @@
<div class="searchicon"></div> <div class="searchicon"></div>
<div class="footer">web新闻网站</div> <div class="footer">web新闻网站</div>
<script> <script>
let totalHight;
let Prostick;
document.addEventListener("DOMContentLoaded", function () { document.addEventListener("DOMContentLoaded", function () {
Prostick = document.querySelector('.Prostick');
totalHight = document.body.scrollHeight - window.innerHeight; totalHight = document.body.scrollHeight - window.innerHeight;
}); });
const Prostick = document.querySelector('.Prostick')
window.addEventListener('scroll', function () { window.addEventListener('scroll', function () {
let pro = (window.pageYOffset / totalHight) * 100; let pro = (window.pageYOffset / totalHight) * 100;
Prostick.style.width = pro + '%'; Prostick.style.width = pro + '%';

Loading…
Cancel
Save