main
AviderMin 1 month ago
parent ccdccbcad5
commit 586c89601e

@ -19,11 +19,12 @@
</div> </div>
<div class="navbar-right"> <div class="navbar-right">
<a href="index.html" class="active">首页</a><div class="line"></div> <a href="#" class="active">首页</a>
<a href="#">新闻分类</a> <a href="#">新闻分类</a>
<a href="#">专题报道</a> <a href="#">专题报道</a>
<a href="#">新闻资讯</a> <a href="#">新闻资讯</a>
<a href="#">互动交流</a> <a href="#">互动交流</a>
<div class="line"></div>
</div> </div>
</div> </div>
<div class="carousel-container"> <div class="carousel-container">
@ -63,9 +64,9 @@
let pro = (window.pageYOffset / totalhHght) * 100 let pro = (window.pageYOffset / totalhHght) * 100
Prostick.style.width = pro + '%' Prostick.style.width = pro + '%'
}) })
const list = document.querySelector('.navbar-right a') const navbarRight = document.querySelector('.navbar-right')
const line = document.querySelector('.line') const line = document.querySelector('.line')
list.addEventListener('click',function(e){ navbarRight.addEventListener('click',function(e){
if (e.target.tagName === 'A'){ if (e.target.tagName === 'A'){
line.style.transform = `translateX(${e.target.tagName}px)` line.style.transform = `translateX(${e.target.tagName}px)`
} }

Loading…
Cancel
Save