国产成人AV无码一二三区,少女1到100集,国产精品久久久久精品综合紧,巜公妇之诱感肉欲HD在线播放

文章 > css教程 > CSS实现轮播图的方法

CSS实现轮播图的方法

CSS轮播图

头像

小妮浅浅

2021-08-30 09:47:408034浏览 · 0收藏 · 0评论

实现思路

1、通过animation达到动起来的效果,具体变化似乎有两种可行方式:

2、在动画中,通过CSS-transform不断平移轮播图元素位置。

3、在动画中,设置不同的left值。

实现效果与代码

其中值得注意的点在于需要手动在轮播图头部添加最后一张图的复制,否则会有明显的闪动效果。

实例

<!DOCTYPE html>
 
<body>
    <div style="flex: 1;height: 300px;z-index: 10;box-shadow: inset 0 0 300px rgba(0, 0, 0, 0.99);">
        left
    </div>
    <div class="showbox border box-shadow">
        <div class="left border">
            左
        </div>
        <div class="right border">
            右
        </div>
        <div id="imgbox" class="center imgbox">
            <img src="https://cdn.pixabay.com/photo/2018/01/03/05/33/the-sun-3057622__340.jpg" />
            <img src="https://cdn.pixabay.com/photo/2021/07/29/20/23/mountains-6508015_960_720.jpg" />
            <img src="https://cdn.pixabay.com/photo/2021/07/29/21/03/cereals-6508088__340.jpg" />
            <img src="https://cdn.pixabay.com/photo/2018/01/03/05/33/the-sun-3057622__340.jpg" />
        </div>
    </div>
    <div  style="flex: 1;height: 300px;z-index: 10;box-shadow: inset 0 0 300px rgba(0, 0, 0, 0.99);" >
        right
    </div>
</body>
<!-- <script>
    let a = 0
    let max = 300 * 3;
    window.onload = function() {
        refresh();
    }
 
    function refresh() {
        document.getElementById("imgbox").style.left = a + "px";
    }
 
    function left() {
        a = (a-300)%max;
        refresh();
    }
 
    function right () {
        a = (a+300)%max;
        refresh();
    }
 
</script> -->
<style>
    body {
        width: 100%;
        height: 100%;
        z-index: 0;
        /* background-color: rgba(0, 0, 0, 0.5); */
        box-shadow: inset 0 0 300px rgba(0, 0, 0, 0.1);
    }
 
    .center {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: center;
    }
 
    .showbox {
        width: 300px;
        height: 300px;
        /* background: chocolate; */
        position: relative;
        overflow: visible;
 
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        /* z-index: -1; */
        opacity: 1;
    }
 
    .left {
        position: absolute;
        left: 0;
        top: 50%;
        cursor: pointer;
        background: blue;
        z-index: 100;
    }
 
    .right {
        position: absolute;
        right: 0;
        top: 50%;
        cursor: pointer;
        background: blue;
        z-index: 100;
    }
 
    .border {
        border: 1px solid black;
    }
 
    .centerimg {
        width: 100%;
        height: 100%;
    }
 
    .myimg {
        width: 300px;
        height: 300px;
        z-index: -1;
        opacity: 1;
        /* filter: alpha(opacity=60); */
    }
    .imgbox {
        position: absolute;
        left: -600px;
        top: 0;
        z-index: -1;
        animation: slideshow 10s both infinite;
    }
 
    @keyframes slideshow {
        0% {
            left: -900px;
        }
        33% {
            left: -600px;
        }
        66% {
            left: -300px;
        }
        100% {
            left: 0;
        }
    }
</style>
 
</html>

以上就是CSS实现轮播图的方法,希望对大家有所帮助。更多css学习指路:css教程

本文教程操作环境:windows7系统、css3版,DELL G3电脑。

关注

关注公众号,随时随地在线学习

本教程部分素材来源于网络,版权问题联系站长!

我在做饭他在下添好爽好硬| 公憩止痒小说原著叫什么名字| YSL水蜜桃86满十八岁多少钱| 水稀美里| 蜜桃| 邱莹莹第一次| 爷爷的鸡又黑又长下一句怎么接| 人犬兽人在线观看免费完整一| 少妇与子亂伦在线看香蕉性视频| 韩剧《酒醉热吻》| 日本M码和欧洲码的区别AS. | 男生把小困困放到女生困里视频 | 巜禁忌7》A片| 《十二寡妇肉床艳史》| 桃色| 《玉尺经》| 传奇大掌柜电视剧全集免费播放| 欧美大妈LOGO大全及价格图| 香港三级巜欲性高蜜桃成熟时类似| 母与子免费观看大全电视剧| 潮湿的体温2| 我被5个男人躁一夜不收我怎么办| 《互换人妻HD中字》| 是空无限传媒免费观看电视剧| 《魅魔之耻》1~4集免费看| 东北娘们国语版免费播放 | 他掀开裙子舌头伸进去添在线视频 | 男女做受A片AAAA| 爸爸的大DJ小说| 女孩蹲下小便视频大全| 闺蜜老公把我压在怀里| 双男主GAI免费观看网站| 一枪战三母2-1免费观看央视网 | 人与动物免费观看电视剧完整版| 日本儿子娶母亲的电视剧| 暴躁姐姐BGM国语版| 妈妈的职业4免费观看完整版高清| 成品人和精品人的区别在哪里知乎| 鲁鲁影院免费观看电视剧电影| 《黏糊糊的你》动漫免费观看| 992TV