微信小程序视频层级过高问题与淘宝商品详情相册展示效果

1.效果图

2.html

	<view class="banner">
		<view class='current_num'>{{current}}/{{imgNum}}</view>
		<swiper circular duration="1000" bindchange="swiperChange">
			<swiper-item wx:for="{{bannerlist}}" wx:key="*this">
				<view wx:if="{{item.type==0}}">
					<image src="{{item.img}}" class="img"></image>
				</view>
				<view wx:else>
					<view wx:if="{{fmShow==true}}">
						<view class='btn_view centerboth' wx:if="{{item.video==''}}"></view>
						<view class='btn_view centerboth' wx:else bindtap='btnPlay'>
							<image src='../../icon/playBtn.png'></image>
						</view>
						<image class='fmimg' src='{{item.img}}'></image>
					</view>
					<video wx:if="{{fmShow==false}}" id="myVideo" src="{{item.video}}"></video>
				</view>
			</swiper-item>
		</swiper>
	</view>

3.js部分、

swiperChange:function(e){//轮播swiper的时候关闭音频播放,封面图片显示

    var that=this;

    this.videoContext.pause();

    var current = e.detail.current+1;

    that.setData({

        current: current,

        fmShow:true,

    })

},

btnPlay: function () {//播放视频隐藏封面图

    var that = this;

    that.setData({

    fmShow: false,

})

this.videoContext.play();

},

4.css部分

.banner{

    width: 750rpx;

    height:705rpx;

    overflow: hidden;

    position: relative;

}

.banner swiper{

    width: 750rpx;

    height:705rpx;

}

.banner swiper view{

    width: 750rpx;

    height:705rpx;

    position: relative;

}

.banner image{

    width: 100%;

    height:705rpx;

}

.banner video{

    width: 100%;

    height: 100%;

}



.banner .btn_view{

    position: absolute;

    width: 750rpx;

    height:705rpx;

    left: 0;

    top: 0;

    z-index: 100;

}

.banner .btn_view image{

    width: 52rpx !important;

    height: 52rpx !important;

}

.fmimg{

    position: absolute;

    width: 750rpx;

    height:705rpx;

    left: 0;

    top: 0;

    z-index: 99;

}

.current_num{

    position: absolute;

    width: 90rpx;
    
    height: 35rpx;

    background: rgba(0, 0, 0, 0.5);

    color: #fff;

    z-index: 99;

    text-align: center;

    font-size: 22rpx;

    border-radius: 35rpx;

    bottom: 35rpx;

    right: 25rpx;

}

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

菜鸟也能逆袭

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值