资讯专栏INFORMATION COLUMN

第四课 波浪导航条

番茄西红柿 / 3104人阅读

摘要:恢复内容开始一效果二知识点清除默认高度字体加粗延迟动画过渡按下标选取集合元素的子元素一般用于没有实际意义的文本,修饰文本,比如标号元素获取标签获取对数组每个元素都执行一次提供的函数三源码关键词描述波浪导航条

---恢复内容开始---

一、效果

 

二、知识点

1、line-height:1;/*清除默认高度*/

2、font-weight: bold;/*字体加粗*/

3、transition-delay: 0.1s;延迟动画过渡

4、:nth-child(1)按下标选取集合元素的子元素

5、一般用于没有实际意义的文本,修饰文本,比如标号

6、var oLi1=document.querySelectorAll(".wrap li");/*元素获取*/

     var oLi=document.getElementsByTagName("li");/*标签获取*/

7、forEach()对数组每个元素都执行一次提供的函数

三、源码

doctype html>
<html>
 <head>
    <meta charset="UTF-8">
    <meta name="Keywords" content="关键词">
    <meta name="Description"  content="描述">
    <title>波浪导航条title>
    <style>
        body{
            margin: 0;
            padding: 0;
            height: 2000px;
            line-height:1;/*清除默认高度*/
        }
        .wrap{
            position: fixed;
            top: 50px;
            right: 0;
            width: 100px;
            height: 400px;
            
        }
        .wrap ol{
            list-style: none;
            margin: 0;
            padding: 0;
        
            color: #fff;
        }
        .wrap:hover li{ 
            left: 0;
        }
        .wrap li{
            position: relative;
            left:70px;
            width: 100%;
            height: 30px;
            border-bottom: 1px solid #fff;
            line-height: 30px;
            color: black;
            transition: 1s;
        }
        /*注释原因用js来写特效,简单有维护性*/
        /* .wrap li:nth-child(1){:nth-child(1)按下标选取集合元素的子元素
            transition-delay: 0;延迟动画过渡
        }
               .wrap li:nth-child(2){:nth-child(1)按下标选取集合元素的子元素
            transition-delay: 0.2s;延迟动画过渡
        }
        .wrap li:nth-child(3){
            transition-delay: 0.3s;
        }
        .wrap li:nth-child(4){
            transition-delay: 0.4s;
        }
        .wrap li:nth-child(5){
            transition-delay: 0.5s;
        }
        .wrap li:nth-child(6){
            transition-delay: 0.6s;
        }
        .wrap li:nth-child(7){
            transition-delay: 0.7s;
        }
        .wrap li:nth-child(8){
            transition-delay: 0.8s;
        }
        .wrap li:nth-child(9){
            transition-delay: 0.9s;
        }
        .wrap li:nth-child(10){
            transition-delay: 1s;
        } */
        span{
            display: inline-block;
            width: 30px;
            height: 30px;
            background-color: #0099ff;
            text-align: center;
            font-weight: bold;/*字体加粗*/
            color: #fff;
        }
        
    style>
 head>
 <body>
    <div class="wrap">
        <ol>
            <li><span>1span>htmlli>
            <li><span>2span>htmlli>
            <li><span>3span>htmlli>
            <li><span>4span>htmlli>
            <li><span>5span>htmlli>
            <li><span>6span>htmlli>
            <li><span>7span>htmlli>
            <li><span>8span>htmlli>
            <li><span>9span>htmlli>
            <li><span>10span>htmlli>
        ol>
    div>
    <script>
        
        var oLi1=document.querySelectorAll(".wrap li");/*元素获取*/
        
        var oLi=document.getElementsByTagName("li");/*标签获取*/

        /*forEach()对数组每个元素都执行一次提供的函数*/
        [].forEach.call(oLi,function(e1,index){
            e1.style.transitionDelay=index*0.08+"s"})
    script>
 body>
html>
View Code

 

---恢复内容结束---

文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。

转载请注明本文地址:https://www.ucloud.cn/yun/1267.html

相关文章

  • 原生js练习题---四课

    摘要:然而问题是,这个法则在导航条的主体是可行的但是子选单因为前面提到的三层嵌套构造圆角,已经无法减少嵌套了,同时还得考虑到子选单也是嵌套在导航条里的啊。。。同理,反过来进入子选单时自然就用来抵消达到筛选的目的。 0x1setTimeout应用 实现效果:4-01setTimeout应用 又见导航条,先看下css,这里用的是雪碧图背景做出圆角的效果,虽然是经典的方法、兼容性好,但这种代码写起...

    Snailclimb 评论0 收藏0
  • vue.js四课 件与循环

    摘要:在字符串模板中,如,我们得像这样写一个条件块模板可以用指令给添加一个块指令随机生成一个数字,判断是否大于,然后输出对应信息在新增,顾名思义,用作的块。可以链式的多次使用指令随机生成一个数字,判断是否大于,然后输出对应信息 条件判断v-if 条件判断使用 v-if 指令:v-if 指令 在元素 和 template 中使用 v-if 指令: 现在你看到我了 菜鸟教程 学的不仅是...

    Arno 评论0 收藏0

发表评论

0条评论

最新活动
阅读需要支付1元查看
<