首页 > 编程知识 正文

小程序swiper掉帧,bootstrap轮播图片自适应

时间:2023-05-04 23:14:35 阅读:23326 作者:4829

轮播尺寸: 713*300

第一种办法:

wxml

siperclass=' banner ' indicator-dots=' true ' mode=' width fix ' indicator-color=' # 333 ' indicator-active-coocod 1.1.jpg '/image/swiper-items wiper-itemimagesrc='/image/image-image src swiper-items wiper-itemimagesrc='

然后我们在效果图:

. banner{ height: 300rpx; }.banner image{ width: 100%; height: 300rpx; (/) 300rpx的轮播大小较高,rpx可以根据屏幕宽度进行调整) /效果图会不会比以前好得多

试着换成尺寸大的

调整大小wxss中加入样式

第二种办法

siperclass=' banner ' indicator-dots=' true ' mode=' width fix ' indicator-color=' # 333 ' indicator-active-coocod 1.1.jpg ' mode=' width fix '/image/swiper-items wiper-1.2.jpg ' mode=' width fix '/image/swiper-items wiper

widthFix :宽度不变,高度自动变化,保持原图长宽比恒定。

首先将image的模式设置为widthFix,然后向图像中添加固定rpx宽度,例如730rpx。

现在图像也可以适应了。 因为小程序的rpx本身就是自适应显示的单位

wxml

swiper{ height: 300rpx; width: 750rpx; }swiper image{ width: 100%; } wxss

效果:

第三种方法

siperclass=' banner ' indicator-dots=' true ' mode=' width fix ' indicator-color=' # 333 ' indicator-active-coocod 1.1.jpg ' mode=' width fix '/image/swiper-items wiper-1.2.jpg ' mode=' width fix '/image/swiper-items wiper

swiper{ height: 300rpx; width:CaCl(100VW*300/713 ) swiperimage (width 3360100 % ); }原理等比例式:原图高度/原图高度=扫掠宽度/扫掠高度

swiper高度=100% *原画高度/原画宽度

wxml

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。