小程序实现图片分层,最上层图片滚动效果
话不多说,上代码:
<view style="position: relative;" catchtouchmove='true'>
<image :src="bg" :style="{height: bgwh + 'px;position: absolute;width: ' + 100 + '%'}">
</image>
<scroll-view scroll-y :style="{'height':wh+'px;width: 100%;'}">
<view>
<image :src="content" class="content-pic"></image>
</view>
</scroll-view>
</view>
bg: '背景图片地址',
content: '上层图片地址',
.content-pic{
position: absolute;
z-index: 2;
height: 1000px;
left: 5%;
top: 4%;
}
注意:catchtouchmove是禁止底层图片滚动,需要在手机端调试才有效果