main
AviderMin 3 weeks ago
parent a3354f2331
commit a956797253

@ -8,6 +8,7 @@
<title>web新闻网站</title> <title>web新闻网站</title>
<link rel="stylesheet" href="css/index.css"> <link rel="stylesheet" href="css/index.css">
</head> </head>
<body> <body>
<div class="Progress"> <div class="Progress">
<div class="Prostick"></div> <div class="Prostick"></div>
@ -33,11 +34,6 @@
<div class="newszy"> <div class="newszy">
<h3>新闻的作用</h3> <h3>新闻的作用</h3>
<ul> <ul>
<li>示例</li>
<li>示例</li>
<li>示例</li>
<li>示例</li>
<li>示例</li>
</ul> </ul>
</div> </div>
<div class="newsinfo"> <div class="newsinfo">
@ -55,22 +51,27 @@
let pro = (window.pageYOffset / totalHight) * 100 let pro = (window.pageYOffset / totalHight) * 100
Prostick.style.width = pro + '%' Prostick.style.width = pro + '%'
}) })
document.addEventListener("DOMContentLoaded",function(){ document.addEventListener("DOMContentLoaded", function () {
let imgs =[]; let imgs = [];
const carouselImages = document.querySelector('.banner img'); const carouselImages = document.querySelector('.banner img');
const dotsContainer = document.querySelector('.dots-container'); const dotsContainer = document.querySelector('.dots-container');
let currentIndex = 0; let currentIndex = 0;
})
document.addEventListener("DOMContentLoaded",function(){ const newszyLis = [
let newszyLis = []; { text: "新闻示例1" },
const liContent = document.querySelector('.newszy li'); { text: "新闻示例2" },
document.write(`<li>${newszyLis.text} </li>`) // ...更多新闻项
}) ];
document.addEventListener("DOMContentLoaded",function(){ const liContent = document.querySelector('.newszy ul');
let newsInfo = [];
const pContent = document.querySelector('.newsinfo p'); newszyLis.forEach(item => {
document.write(`<p>${newsInfo.text} </p>`) const li = document.createElement('li');
}) li.textContent = item.text;
liContent.appendChild(li);
});
});
</script> </script>
</body> </body>

Loading…
Cancel
Save