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.

97 lines
3.3 KiB

1 month ago
<!DOCTYPE html>
<html lang="zh">
1 month ago
<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">
1 month ago
<title>web新闻网站</title>
1 month ago
<link rel="stylesheet" href="css/index.css">
1 month ago
<link rel="stylesheet" href="css/common.css">
1 month ago
</head>
1 month ago
1 month ago
<body>
<div class="Progress">
<div class="Prostick"></div>
</div>
<div class="navbar">
<div class="navinit">
<div class="logo">web新闻网站</div>
<div class="navbtnpart">
1 month ago
<div class="navbtn DStyle"><a href="index.html">首页</a></div>
<div class="navbtn DStyle"><a href="newsclass.html">新闻分类</a></div>
<div class="navbtn DStyle"><a href="foucsreport.html">专题报道</a></div>
<div class="navbtn DStyle"><a href="newsinfo.html">新闻资讯</a></div>
<div class="navbtn DStyle"><a href="#">互动交流</a></div>
1 month ago
</div>
</div>
</div>
<div class="mainbody">
<div class="banner">
1 month ago
<img src="">
1 month ago
</div>
1 month ago
<div class="dots-container"></div>
1 month ago
<div class="newszy">
<h3>新闻的作用</h3>
<ul>
</ul>
</div>
<div class="newsinfo">
<h3>新闻的定义</h3>
</div>
</div>
<div class="footer">web新闻网站</div>
1 month ago
<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 + '%';
}
});
1 month ago
</script>
</body>
</html>