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 () {
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; let pro = (window.pageYOffset / totalHight) * 100;
Prostick.style.width = pro + '%'; Prostick.style.width = pro + '%';

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

Loading…
Cancel
Save