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.

114 lines
4.8 KiB

<!DOCTYPE html>
<html lang="zh">
<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">
<title>web新闻网站</title>
<link rel="stylesheet" href="css/index.css">
<link rel="stylesheet" href="css/common.css">
</head>
<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 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>
</div>
</div>
</div>
<div class="mainbody">
<div class="banner">
<img src="">
</div>
<div class="dots-container"></div>
<div class="newszy">
<h3>新闻的作用</h3>
<ul>
</ul>
</div>
<div class="newsinfo">
<h3>新闻的定义</h3>
</div>
</div>
<div class="footer">web新闻网站</div>
<script>
let totalHight;
let Prostick;
const imgs = document.querySelector('.banner img')
let Picsrc = [
{ src: '../image/1rd.png' },
{ src: '../image/2rd.jpg' },
{ src: '../image/3rd.jpg' },
{ src: '../image/4rd.jpg' }
]
let i = 0
setInterval(function Imgs() {
if (i < Picsrc.length) {
imgs.src = Picsrc[i].src
console.log(i)
i++
if (i == Picsrc.length) {
i = 0
}
}
}, 2000)
window.addEventListener('load', function () {
imgs.src = Picsrc[0].src
})
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.新闻媒介还传播各种趣味性内容,如奇闻异事、风土人情等,在紧张工作得到娱乐和享受。" },
];
const liContent = document.querySelector('.newszy ul');
newszyLis.forEach(item => {
const li = document.createElement('li');
li.textContent = item.text;
liContent.appendChild(li);
});
let newsinfo = [
{ 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.documentElement.scrollHeight - window.innerHeight;
});
window.addEventListener('scroll', function () {
if (totalHight && Prostick) {
let pro = (window.pageYOffset / totalHight) * 100;
Prostick.style.width = pro + '%';
}
});
</script>
</body>
</html>