|
|
|
@ -41,47 +41,55 @@
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="footer">web新闻网站</div>
|
|
|
|
|
<script>
|
|
|
|
|
document.addEventListener("DOMContentLoaded", function () {
|
|
|
|
|
let imgs = [];
|
|
|
|
|
const carouselImages = document.querySelector('.banner img');
|
|
|
|
|
const dotsContainer = document.querySelector('.dots-container');
|
|
|
|
|
let currentIndex = 0;
|
|
|
|
|
|
|
|
|
|
let newszyLis = [
|
|
|
|
|
{ text: "新闻示例1" },
|
|
|
|
|
{ text: "新闻示例2" },
|
|
|
|
|
{ text: "新闻示例3" },
|
|
|
|
|
{ text: "新闻示例4" },
|
|
|
|
|
{ text: "新闻示例5" },
|
|
|
|
|
{ text: "新闻示例6" },
|
|
|
|
|
];
|
|
|
|
|
const liContent = document.querySelector('.newszy ul');
|
|
|
|
|
|
|
|
|
|
newszyLis.forEach(item => {
|
|
|
|
|
const li = document.createElement('li');
|
|
|
|
|
li.textContent = item.text;
|
|
|
|
|
liContent.appendChild(li);
|
|
|
|
|
});
|
|
|
|
|
let newsinfo = [
|
|
|
|
|
{ text: "示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例" },
|
|
|
|
|
{ text: "示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例" },
|
|
|
|
|
{ text: "示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例示例" },
|
|
|
|
|
];
|
|
|
|
|
const pContent = document.querySelector('.newsinfo');
|
|
|
|
|
|
|
|
|
|
newsInfo.forEach(item => {
|
|
|
|
|
const p = document.createElement('p');
|
|
|
|
|
p.textContent = item.text;
|
|
|
|
|
pContent.appendChild(p);
|
|
|
|
|
});
|
|
|
|
|
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 + '%';
|
|
|
|
|
})
|
|
|
|
|
<script>
|
|
|
|
|
let totalHight;
|
|
|
|
|
let Prostick;
|
|
|
|
|
|
|
|
|
|
document.addEventListener("DOMContentLoaded", function () {
|
|
|
|
|
let imgs = [];
|
|
|
|
|
const carouselImages = document.querySelector('.banner img');
|
|
|
|
|
const dotsContainer = document.querySelector('.dots-container');
|
|
|
|
|
let currentIndex = 0;
|
|
|
|
|
|
|
|
|
|
let newszyLis = [
|
|
|
|
|
{ text: "新闻示例1" },
|
|
|
|
|
{ text: "新闻示例2" },
|
|
|
|
|
{ text: "新闻示例3" },
|
|
|
|
|
{ text: "新闻示例4" },
|
|
|
|
|
{ text: "新闻示例5" },
|
|
|
|
|
{ text: "新闻示例6" },
|
|
|
|
|
];
|
|
|
|
|
const liContent = document.querySelector('.newszy ul');
|
|
|
|
|
|
|
|
|
|
newszyLis.forEach(item => {
|
|
|
|
|
const li = document.createElement('li');
|
|
|
|
|
li.textContent = item.text;
|
|
|
|
|
liContent.appendChild(li);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
let newsinfo = [
|
|
|
|
|
{ text: "很长很长的示例文本..." },
|
|
|
|
|
{ text: "另一个很长很长的示例文本..." },
|
|
|
|
|
{ text: "还有一个很长很长的示例文本..." },
|
|
|
|
|
];
|
|
|
|
|
const pContent = document.querySelector('.newsinfo');
|
|
|
|
|
|
|
|
|
|
newsinfo.forEach(item => {
|
|
|
|
|
const p = document.createElement('p');
|
|
|
|
|
p.textContent = item.text;
|
|
|
|
|
pContent.appendChild(p);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
Prostick = document.querySelector('.Prostick');
|
|
|
|
|
totalHight = document.body.scrollHeight - window.innerHeight;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
window.addEventListener('scroll', function () {
|
|
|
|
|
if (totalHight && Prostick) {
|
|
|
|
|
let pro = (window.pageYOffset / totalHight) * 100;
|
|
|
|
|
Prostick.style.width = pro + '%';
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
</body>
|
|
|
|
|
|
|
|
|
|