原生js实现全屏头部导航幻灯片切换效果代码
代码语言:html
所属分类:幻灯片
代码描述:原生js实现全屏头部导航幻灯片切换效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <style> html, body, ul, li { margin: 0; padding: 0; border: 0; } .item { height:1000px; width: 100%; background: red; } .aitem_list { display: flex; height: 50px; position: fixed; width: 100%; z-index: 10; background: #ffffff; } .atime { display: flex; justify-content: center; align-items: center; width: 25%; } .list { padding-top: 50px; } .aitem_list .active { background-color: #222222;color: aliceblue } .item .item_header { height: 50px; background: #1f1f1f; width: 100%; display: flex; justify-content: center; align-items: center; color: #ffffff; } .item .active { position: fixed; top: 50px; } </style> </head> <body> <ul class="aitem_list"> <li class="atime active" onclick="toscroll(0)">1</li> <li class="atime" onclick="toscroll(1)">2</li> <li class="atime" onclick="toscroll(2)">3</li> <li class="atime" onclick="toscroll(3)">4</li> <li class="atime" onclick="toscroll(4)">5</li> <li class="atime" onclick="toscroll(5)">6</li> <li class="atime" onclick="toscroll(6)">7</li> <li class="atime" onclick="toscroll(7)">8</li> </ul> <div class="list"> <div class="item" style="background:#1abc9c;" onclick="toscroll(0)"> <div class="item_header" style="background:1abc9c;">第一个</div> </div> <div class="item" style="background:#2ecc71;" onclick="toscroll(1)"> <div class="item_header" style="background:2ecc71;">第二个</div> </div> <div class="item" style="background:#3498db;" onclick="toscroll(2)"> <div class="item_header" style="background:rebeccapurple;">第三个</div> </div> <div class="item" style="background:#9b59b6;" onclick="toscroll(3)"> <div class="item_header" style="background:9b59b6;">第四个</div> </div> <div class="item" style="background:#34495e;" onc.........完整代码请登录后点击上方下载按钮下载查看
网友评论0