发表于: 2020-01-17 23:30:47

1 1301


今天完成的事

1.将任务14的代码复制到15


2.将栅格系统拆解出来单独放入一个文件并引入


3.将页眉部分关于bootstrap的样式拆解出来


4.根据任务14的效果自己完善nav部分的样式


5.学习input的相关知识 使用type="checked"来触发点击事件 达到移动端屏幕宽度下导航栏点击显示与隐藏的效果


6.将原先nav组件由bootstrap转为自己写的代码来实现导航栏移动端显示与隐藏时input点击事件时就是不生效 卡了几天

不得已将整个nav部分删除重构

<!--导航栏-->
<nav class="nav">
    <div class="container">
        <div class="row">
            <a class="nav-home col-md-4" href="#">IT修真院</a>
            <input type="checkbox" id="nav-input" class="nav-input">
            <label for="nav-input" class="nav-label">
                <span class="nav-span"></span>
                <span class="nav-span"></span>
                <span class="nav-span"></span>
            </label>
            <ul class="nav-ul">
                <li><a href="" class="">首页</a></li>
                <li><a href="" class="">职业</a></li>
                <li><a href="" class="">推荐</a></li>
                <li><a href="" class="">关于</a></li>
            </ul>
        </div>
    </div>
</nav>


7.重构之后导航栏按钮终于生效 调整样式

.nav {
    displayblock;
    positionfixed;
    height50px;
    background-colorrgb(29177118);
    width100%;
    .row {
        .nav-home {
            colorwhite;
            font-size24px;
            line-height50px;
        }
        .nav-input {
            displaynone;
        }
        .nav-label {
            positionrelative;
            floatright;
            padding14px 10px;
            margin7px 15px 8px auto;
            border1px solid white;
            border-radius4px;
            .nav-span {
                displayblock;
                positionrelative;
                height2px;
                width30px;
                background-color#888;
            }
            .nav-span:nth-of-type(1) {
                top-7px;
            }
            .nav-span:nth-of-type(3) {
                top7px;
            }

        }
        .nav-ul {
            displaynone;
        }
    }
}

@media screen and (min-width765px) {
    .nav-label {
        displayblock;
    }
}

#nav-input:checked~.nav-ul {
    displayflex;
    width100%;
    justify-contentspace-between;
    flex-directioncolumn;
    .nav-li-a {
        displayblock;
        height40px;
        width100%;
        text-aligncenter;
        line-height40px;
        colorwhite;
    }
    .nav-li:hover {
        border-bottom2px solid white;
    }
}


8.继续调整nav部分的样式声明

.nav {
    displayblock;
    positionfixed;
    height50px;
    background-colorrgb(29177118);
    width100%;
    .row {
        .nav-home {
            colorwhite;
            font-size24px;
            line-height50px;
        }
        .nav-input {
            displaynone;
        }
        .nav-label {
            displaynone;

        }
        .nav-ul {
            displayflex;
            floatright;
            flex-directionrow;
            justify-contentspace-between;
            .nav-li-a {
                displayblock;
                colorwhite;
                height50px;
                text-aligncenter;
                line-height50px;
                width50px;
                margin-bottom-4px;
            }
            .nav-li:hover {
                border-bottom4px solid white;
            }
        }
    }
}


@media screen and (max-width765px) { /*使导航栏按钮在屏幕宽度小于765px的情况下才显示*/
    .nav-label {
        displayblock !important;
        positionrelative;
        floatright;
        padding14px 10px;
        margin7px 15px 8px auto;
        border1px solid white;
        border-radius4px;
        .nav-span {
            displayblock;
            positionrelative;
            height2px;
            width30px;
            background-color#888;
        }
        .nav-span:nth-of-type(1) {
            top-7px;
        }
        .nav-span:nth-of-type(3) {
            top7px;
        }
    }
    .nav-li-a {
        overflowhidden
        width:0 !important
        height:0 !important;
    }
}

#nav-input:checked~.nav-ul { /*点击按钮之后使隐藏导航栏显示并赋予样式声明*/
    displayflex;
    width100%;
    justify-contentspace-between;
    flex-directioncolumn;
    .nav-li-a {
        displayblock;
        height40px !important;
        width100% !important;
        text-aligncenter;
        line-height40px;
        colorwhite;
        margin0 !important;
    }
}


9.轻微改动header部分的HTML架构与样式


10.重新简单架构轮播图部分 使用@keyframes来实现轮播效果 

<!--轮播图模块 "banner.less"-->
<div class="banner">
    <div class="banner-wrap">
        <img src="../task15/imag/image1.png">
        <img src="../task15/imag/image2.png">
        <img src="../task15/imag/image3.png">
    </div>
</div>


.banner {
    overflowhidden;
    width100vw;
    .banner-wrap {
        displayinline-flex;
        positionrelative;
        width300vw;
        overflowhidden;
        animation: banner linear 10s infinite 0s alternate;
        -webkit-animation: banner linear 10s infinite 0s alternate;
        img {
            displayblock;
            width100vw;
            heightauto;
        }
    }
}

@keyframes banner {
    0% {
        left0;
    }
    20% {
        left-0vw;
    }
    40% {
        left-100vw;
    }
    60% {
        left-100vw;
    }
    80% {
        left-200vw;
    }
    100% {
        left-200vw;
    }
}


11.为了使用无缝衔接的效果而不是跳转到第一张图片 多添加一张图片在末尾 使跳转的瞬间不被察觉

<div class="banner">
    <div class="banner-wrap">
        <img src="../task15/imag/image1.png">
        <img src="../task15/imag/image2.png">
        <img src="../task15/imag/image3.png">
        <img src="../task15/imag/image1.png">
    </div>
</div>



@keyframes banner {
    0% {
        left0;
    }
    10% {
        left-0vw;
    }
    13.3% {
        left-100vw;
    }
    33.3% {
        left-100vw;
    }
    36.6% {
        left-200vw;
    }
    66.6% {
        left-200vw;
    }
    69.9%  {
        left-300vw
    }
    100% {
        left-300vw;
    }
}


12.轮播图下部添加圆点焦点 添加架构 与轮播图主体使用一样的动画时间设置 

在架构上使用五个子元素来完成 设置父容器只显示三个 

   <div class="banner-wrap2"> 
        <ul class="banner-ul">
            <li></li>
            <li></li>
            <li class="banner-li-1"></li>
            <li></li>
            <li></li>
        </ul>
   </div>   


    .banner-wrap2 {
        displayblock;
        positionrelative;
        width9vw;
        top-2vw;
        heightauto;
        marginauto auto;
        overflowhidden;
        .banner-ul {
            displayflex;
            justify-contentspace-around;
            positionrelative;
            width15vw;
            floatright;
            animationli linear 10s infinite 0s normal;
            -webkit-animationli linear 10s infinite 0s normal;
            li {
                displayblock;
                border3px solid white;
                border-radius50%;
            }
            .banner-li-1 {
                displayblock;
                positionrelative;
                border3px solid rgb(29177118);
            }
        }
    }
@keyframes li {
    0% {
        right0;
    }
    10% {
        right0;
    }
    13.3% {
        right-3vw;
    }
    33.3% {
        right-3vw;
    }
    36.6% {
        right-6vw;
    }
    66.6% {
        right-6vw;
    }
    69.9%  {
        right0vw;
    }
    100% {
        right0vw;
    }
}


13.大图标部分外部容器添加overflow:hidden 


14.如何学习部分外部容器添加overflow:hidden。


15.重构优秀学员展示部分


16.完善样式 并使用动画效果完成轮播图


17.对其他部分做细微调整 完成页面一


18.提交任务




明天计划的事


1.开始学习JS


2.进行js第一个任务





遇到的问题 

1.移动端宽度的情况下由765px以下宽度变为以上宽度时 展开的导航栏的排列不会自动变成横向

不知道实际情况中这种情况会不会产生影响 

而使用bootstrap框架在屏幕宽度由765px以下往上变宽的时候展开的上下排布的导航栏会自动会变成横向排列

暂时没想到好的解决方案 尝试使用媒体查询大于765px屏幕宽度的方法不能达到要求。


2.大图标说明部分容器没高度 百度之后添加上了overflow:hidden 

使容器强制适配内部元素的高度与宽度。





今天的收获

1.不是自己写的代码 即使暂时复制使用了 日后维护起来不懂底层原理还是会遇到很多困难


2.学习了如何使用纯CSS实现轮播图自动播放的效果

手把手教你用纯css3实现轮播图效果

http://www.imooc.com/article/76377#


如何用纯c4ss3实现轮播图

https://blog.csdn.net/weixin_42276859/article/details/8064894


学会了@keyframes动画的基础使用 

百分比可以设置停滞时间与动画播放时间 







返回列表 返回列表
评论

    分享到