|
|
|
@ -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>
|
|
|
|
|
|
|
|
|
|