姜玉琪_20210120-姜玉琪

知识点总结:

关于流加载的例子:

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <title></title>
        <link rel="stylesheet" type="text/css" href="layui/css/layui.css"/>
        <style type="text/css">
            p{
                height: 200px;
            }
        </style>
    </head>
    <body>
        <div class="flow-default" id="LAY_demo1">
            <p>默认</p>
            <p>默认</p>
            <p>默认</p>
            <p>默认</p>
            <p>默认</p>
            <p>默认</p>
            <p>默认</p>
            <p>默认</p>
        </div>
        <script src="layui/layui.js" type="text/javascript" charset="utf-8"></script>
        <script type="text/javascript">
            layui.use('flow', function(){
              var flow = layui.flow;
                flow.load({
                    elem: '#LAY_demo1' //流加载容器
                    // ,scrollElem: '#LAY_demo1' //滚动条所在元素,一般不用填,此处只是演示需要。
                    ,end: '弹尽粮绝'
                    ,done: function(page, next){ //执行下一页的回调
                      //模拟数据插入
                      setTimeout(function(){
                        var lis = [];
                        for(var i = 0; i < 8; i++){
                          lis.push('<p>'+ ( (page-1)*8 + i + 1 ) +'</p>')
                        }
                        
                        //执行下一页渲染,第二参数为:满足“加载更多”的条件,即后面仍有分页
                        //pages为Ajax返回的总页数,只有当前页小于总页数的情况下,才会继续出现加载更多
                        next(lis.join(''), page < 3); //假设总页数为 3
                      }, 500);
                    }
                  });
              });
        </script>
    </body>
</html>

关于轮播的例子:

<head>
    <meta charset="utf-8">
    <title>页面轮播</title>
    <link rel="stylesheet" type="text/css" href="css/swiper.css"/>
    <style type="text/css">
         html, body {
                position: relative;
                height: 100%;
            }
            body {
                background: #eee;
                font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
                font-size: 14px;
                color:#000;
                margin: 0;
                padding: 0;
            }
            .swiper-container {
                width: 100%;
                height: 100%;
                margin-left: auto;
                margin-right: auto;
            }
            .swiper-slide {
                text-align: center;
                font-size: 18px;
                background: #fff;

                /* Center slide text vertically */
                display: -webkit-box;
                display: -ms-flexbox;
                display: -webkit-flex;
                display: flex;
                -webkit-box-pack: center;
                -ms-flex-pack: center;
                -webkit-justify-content: center;
                justify-content: center;
                -webkit-box-align: center;
                -ms-flex-align: center;
                -webkit-align-items: center;
                align-items: center;
            }
    </style>
</head>
<body>
    <div class="swiper-container">
        <div class="swiper-wrapper">
            <div class="swiper-slide">Slide 1</div>
            <div class="swiper-slide">Slide 2</div>
            <div class="swiper-slide">Slide 3</div>
            <div class="swiper-slide">Slide 4</div>
            <div class="swiper-slide">Slide 5</div>
            <div class="swiper-slide">Slide 6</div>
            <div class="swiper-slide">Slide 7</div>
            <div class="swiper-slide">Slide 8</div>
            <div class="swiper-slide">Slide 9</div>
            <div class="swiper-slide">Slide 10</div>
        </div>
        <!-- 右侧导航 -->
        <div class="swiper-pagination"></div>
        </div>
    <script src="js/swiper.js" type="text/javascript" charset="utf-8"></script>
    <script>
         var swiper = new Swiper('.swiper-container', {
                pagination: '.swiper-pagination',
                direction: 'vertical',
                slidesPerView: 1,
                paginationClickable: true,
                spaceBetween: 30,
                mousewheelControl: true
            });
    </script>
</body>
</html>

心得体会:

​ 今天开始做一个简单的网页,对学过的东西还是不知道怎么应用!问题很多,实践了才知道要熟练应用还要多做练习!对js如何添加到网页不怎么会,但可以利用layui或者bootstrap等网站中的框架直接套用修饰自己的网页。

标签

评论

© 2021 成都云创动力科技有限公司 蜀ICP备20006351号-1