You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

88 lines
3.4 KiB

4 weeks ago
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
4 weeks ago
<title>web新闻网站</title>
4 weeks ago
<link rel="stylesheet" href="css/index.css">
</head>
4 weeks ago
4 weeks ago
<body>
<div class="Progress">
<div class="Prostick"></div>
</div>
<div class="navbar">
<div class="navinit">
<div class="logo">web新闻网站</div>
<div class="navbtnpart">
<div class="navbtn"><a href="index.html">首页</a></div>
<div class="navbtn"><a href="newsclass.html">新闻分类</a></div>
<div class="navbtn"><a href="#">专题报道</a></div>
<div class="navbtn"><a href="#">新闻资讯</a></div>
<div class="navbtn"><a href="#">互动交流</a></div>
</div>
</div>
</div>
<div class="mainbody">
<div class="banner">
4 weeks ago
<img src="">
4 weeks ago
</div>
4 weeks ago
<div class="dots-container"></div>
4 weeks ago
<div class="newszy">
<h3>新闻的作用</h3>
<ul>
</ul>
</div>
<div class="newsinfo">
<h3>新闻的定义</h3>
</div>
</div>
<div class="footer">web新闻网站</div>
<script>
4 weeks ago
document.addEventListener("DOMContentLoaded", function () {
let imgs = [];
4 weeks ago
const carouselImages = document.querySelector('.banner img');
const dotsContainer = document.querySelector('.dots-container');
let currentIndex = 0;
4 weeks ago
4 weeks ago
let newszyLis = [
4 weeks ago
{ text: "新闻示例1" },
{ text: "新闻示例2" },
4 weeks ago
{ text: "新闻示例3" },
{ text: "新闻示例4" },
{ text: "新闻示例5" },
{ text: "新闻示例6" },
4 weeks ago
];
const liContent = document.querySelector('.newszy ul');
newszyLis.forEach(item => {
const li = document.createElement('li');
li.textContent = item.text;
liContent.appendChild(li);
});
4 weeks ago
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;
4 weeks ago
});
4 weeks ago
const Prostick = document.querySelector('.Prostick')
window.addEventListener('scroll', function () {
let pro = (window.pageYOffset / totalHight) * 100;
Prostick.style.width = pro + '%';
})
4 weeks ago
</script>
</body>
</html>