vue+velocity实现锚点内容导航效果代码
代码语言:html
所属分类:菜单导航
代码描述:vue+velocity实现锚点内容导航效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <style> * { margin: 0; padding: 0; } #app { width: 100%; height: 100vh; overflow-y: scroll; background: #f1f1f1; } header { width: 100%; height: 60px; position: fixed; top: 0px; left: 0px; z-index: 1; background: #fff; display: flex; display: -webkit-flex; justify-content: center; } header a { width: 200px; height: 60px; display: block; text-align: center; line-height: 60px; color: #333333; text-decoration: none; } header a:hover, header a.active { color: dodgerblue; } #home, #team, #contact, #join { width: 100%; height: 500px; color: #FFFF; font-size: 30px; text-align: center; line-height: 500px; } #home { background: tomato; } #team { background: deepskyblue; } #contact { background: orange; } #join { background: lightgreen; } </style> </head> <body > <div id="app"> <header> <a href="javascript:;" :class="active == '#home' ? 'active' : ''" @click="toTarget('#home')">首页</a> <a href="javascript:;" :class="active == '#team' ? 'active' : ''" @click="toTarget('#team')">团队</a> <a href="javascript:;" :class="active == '#contact' ? 'active' : ''" @click="toTarget('#contact')">联系</a> <a href="javascript:;" :class="active == '#join' ? 'active' : ''" @click="toTarget('#join')">加入我们</a> </header> <div id="home"> 首页 </div> <div id="team"> 团队 </div> <div id=&.........完整代码请登录后点击上方下载按钮下载查看
网友评论0