main
AviderMin 3 weeks ago
parent a3354f2331
commit a956797253

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

Loading…
Cancel
Save