qq_37813237 2022-09-19 15:10 采纳率: 100%
浏览 45
已结题

滑动背景中轮播图不显示

问题遇到的现象和发生背景

写一个移动端的滑动背景,现在想在背景2上加一个轮播图,但是轮播图无法显示,一开始猜测是背景颜色遮盖了轮播图,但为轮播图div加上z-index,又尝试去除背景颜色,轮播图还是不显示

用代码块功能插入代码,请勿粘贴截图
<div class="propa">
<div class="container">
        <div class="f1">1</div>
        <div class="s2">
            <div class="swiper-text">
                <div class="swiper-wrap"></div>
                <div class="swiper">
                    <div class="swiper-img-d"><img src="@/common/image/123.png"></div>
                    <div class="swiper-img"><img src="@/common/image/周杰伦_我是如此相信_4.jpg"></div>
                    <div class="swiper-img"><img src="@/common/image/彩珠.jpg"></div>
                    <div class="swiper-img"><img src="@/common/image/2.jpg"></div>
                </div>
            </div>
        </div>
        <div class="t3">3</div>
        <div class="f4">4</div>
    </div>
 </div>

.propa{
        margin:0;
        padding: 0;
        overflow-x:hidden ;
    }
 .container{
        width: 100vw;
        height: 100vh;
        scroll-snap-type: y mandatory;
        overflow-y: scroll;
        overflow-x: hidden;
    }
    .container .f1{
        width: 100vw;
        height: 100vh;
        display: flex;
        justify-content: center;
        align-items: center;
        background-color: gold;
        color:#fff;
        scroll-snap-align: start;
    }
    .container .s2{
        width: 100vw;
        height: 100vh;
        display: flex;
        justify-content: center;
        align-items: center;
        background-color: gold;
        color:#fff;
        scroll-snap-align: start;
    }
    .container .t3{
        width: 100vw;
        height: 100vh;
        display: flex;
        justify-content: center;
        align-items: center;
        background-color: gold;
        color:#fff;
        scroll-snap-align: start;
    }
    .container .f4{
        width: 100vw;
        height: 100vh;
        display: flex;
        justify-content: center;
        align-items: center;
        background-color: gold;
        color:#fff;
        scroll-snap-align: start;
    }
    .swiper-text{
        position: relative;
        width: 10rem;
        display: flex;
        justify-content: space-evenly;
        z-index:99;
    }
    .swiper-wrap{
        width: 25rem;
        height: 31rem;
        transition: .4s;
        background-size: cover;
    }
    .swiper{
        width: 3rem;
        height: 7.5rem;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }
    .swiper-img{
        position:relative;
        width:3rem;
        height:1rem;
        right:0;
        transition: 0.1rem;
        overflow: hidden;
    }
    .swiper-img .img{
        position: absolute;
        width: 3rem;
        transform: translate(0,-0.5rem);
        transition: .5s;
        right: 0;
    }
    .swiper-img-d{
        opacity: 0;
        right: 3.8rem;
    }
    .swiper-img:hover img{
        opacity: 0;
        right: 7.8rem;
    }


  • 写回答

2条回答 默认 最新

  • CSDN专家-showbo 2022-09-19 15:25
    关注

    结构是不是搞错了?swiper应该是在swiper-wrap容器里面吧?

    img


    而且宽度设置也是有问题。。
    .swiper-text应该是flex:1,去掉width,不去掉也行
    .swiper-wrap加上flex:1
    而且显示的第一张图片样式是swiper-img-d,opacity:0是透明的,看着和没有一样

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论 编辑记录
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 9月27日
  • 已采纳回答 9月19日
  • 创建了问题 9月19日

悬赏问题

  • ¥20 关于#stm32#的问题:需要指导自动酸碱滴定仪的原理图程序代码及仿真
  • ¥20 设计一款异域新娘的视频相亲软件需要哪些技术支持
  • ¥15 stata安慰剂检验作图但是真实值不出现在图上
  • ¥15 c程序不知道为什么得不到结果
  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因