国产成人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电脑。

关注

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

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

坤坤寒入桃子里电视剧| 一边做饭一边狂躁的原因分析| 皇上被群臣扒开腿狂C| 真人刺激战场40分钟电视剧| B站暴躁女RAPPER| 五姑娘影院在线观看免费版电视剧 | 浏览器| 女生给男生吃小头头| 《疯狂伴娘》在线观看| 《地下偶像》樱花动浸| 醉红楼| 把腿开大点我添添你SB| 黄文| 双男主做酱酱酿酿视频大全真人版 | 琪亚娜| 今日看料-今日看料每日更新| 女人尝试到更粗大的心理变化| 《朋友的未婚妻》| 美女和帅哥一起努力生产豆浆的视.| 做爰高潮A片(毛片)| 《女朋友的妹妹3》| JK制服| 无风险9.1免费版观看| 《完美邻居》电影在线观看| 今天的高清视频在线观看高清 | 男人晚上吃奶时乳房会变| 我把校花嘴巴当套子的小说| 不戴套干新婚少妇小琳| 狗配人的大片视频大全| 双腿无力合拢红肿外翻男生原因| YSL千人千色T9T9T9T9...| 女人一旦尝到粗硬的心理 | 欧美IPHONEXR| 黄金网站9.1免费入口| 《老公请部长家里吃饭》日剧| 三男一女CP免费观看电视剧大全 | 法国人妻亂伦| 坤坤寒入桃子里电视剧免费看 | 两人世界高清完整版免费观看 | 三个男人躁我一个爽的后果及影响| 日本一姐RAPPER太多