在每个页面加入进度条和DOM加载功能

main
AviderMin 3 weeks ago
parent baf744b33d
commit 4ef0c37f87

@ -6,12 +6,28 @@ a{
text-decoration: none;
}
.Progress {
width: 100%;
padding: 0;
margin: 0;
position: fixed;
top: 0px;
z-index: 1000;
}
.Prostick {
width: 0;
background-color: #0091EA;
height: 5px;
}
.navbar{
width: 100%;
height: 65px;
position: fixed;
background-color: lightgray;
top: 0;
box-shadow: 0px 6px 5px rgb(179, 175, 175);
}
.navinit{
width: 980px;

@ -6,12 +6,30 @@ a{
text-decoration: none;
}
.Progress {
width: 100%;
padding: 0;
margin: 0;
position: fixed;
top: 0px;
z-index: 1000;
}
.Prostick {
width: 0;
background-color: #0091EA;
height: 5px;
}
.navbar{
width: 100%;
height: 65px;
position: fixed;
background-color: lightgray;
top: 0;
box-shadow: 0px 6px 5px rgb(179, 175, 175);
}
.navinit{
width: 980px;

@ -6,12 +6,28 @@ a{
text-decoration: none;
}
.Progress {
width: 100%;
padding: 0;
margin: 0;
position: fixed;
top: 0px;
z-index: 1000;
}
.Prostick {
width: 0;
background-color: #0091EA;
height: 5px;
}
.navbar{
width: 100%;
height: 65px;
position: fixed;
background-color: lightgray;
top: 0;
box-shadow: 0px 6px 5px rgb(179, 175, 175);
}
.navinit{
width: 980px;

@ -8,6 +8,9 @@
<link rel="stylesheet" href="css/foucsreport.css">
</head>
<body>
<div class="Progress">
<div class="Prostick"></div>
</div>
<div class="navbar">
<div class="navinit">
<div class="logo">web新闻网站</div>
@ -60,5 +63,18 @@
</div>
<div class="footer">web新闻网站</div>
<script>
document.addEventListener("DOMContentLoaded", function () {
totalHight = document.body.scrollHeight - window.innerHeight;
});
const Prostick = document.querySelector('.Prostick')
window.addEventListener('scroll', function () {
let pro = (window.pageYOffset / totalHight) * 100;
Prostick.style.width = pro + '%';
})
</script>
</body>
</html>

@ -45,8 +45,6 @@
</div>
<div class="footer">web新闻网站</div>
<script>
// let totalHight = document.body.scrollHeight - window.innerHeight
document.addEventListener("DOMContentLoaded", function () {
let imgs = [];
const carouselImages = document.querySelector('.banner img');

@ -8,6 +8,9 @@
<link rel="stylesheet" href="css/newsclass.css">
</head>
<body>
<div class="Progress">
<div class="Prostick"></div>
</div>
<div class="navbar">
<div class="navinit">
<div class="logo">web新闻网站</div>
@ -43,5 +46,18 @@
</div>
</div>
<div class="footer">web新闻网站</div>
<script>
document.addEventListener("DOMContentLoaded", function () {
totalHight = document.body.scrollHeight - window.innerHeight;
});
const Prostick = document.querySelector('.Prostick')
window.addEventListener('scroll', function () {
let pro = (window.pageYOffset / totalHight) * 100;
Prostick.style.width = pro + '%';
})
</script>
</body>
</html>

@ -8,6 +8,9 @@
<link rel="stylesheet" href="css/newsinfo.css">
</head>
<body>
<div class="Progress">
<div class="Prostick"></div>
</div>
<div class="navbar">
<div class="navinit">
<div class="logo">web新闻网站</div>
@ -23,5 +26,18 @@
<div class="searchbox"></div>
<div class="searchicon"></div>
<div class="footer">web新闻网站</div>
<script>
document.addEventListener("DOMContentLoaded", function () {
totalHight = document.body.scrollHeight - window.innerHeight;
});
const Prostick = document.querySelector('.Prostick')
window.addEventListener('scroll', function () {
let pro = (window.pageYOffset / totalHight) * 100;
Prostick.style.width = pro + '%';
})
</script>
</body>
</html>
Loading…
Cancel
Save