闪吧音效,滴血玫瑰英文,门第迅雷下载
swiper是纯javascript打造的滑动特效插件,面向手机、平板电脑等移动终端。
swiper能实现触屏焦点图、触屏tab切换、触屏多图切换等常用效果。
swiper开源、免费、稳定、使用简单、功能强大,是架构移动终端网站的重要选择!
在写微信小程序时,有写到实现3d轮播图的效果,可以直接使用微信小程序中自带的组件swiper来实现
效果图如下:
1.swiper的相关属性
这里主要利用了circular实现无限滚动,然后再加上前后间距,再设置图片的层级和透明度就可以实现了,将图片及容器的高度设置好就差不多可以实现了
wxml文件
<!--carousel/index.wxml--> <swiper class="imagecontainer" bindchange="handlechange" previous-margin="50rpx" next-margin="50rpx" circular autoplay> <block wx:for="{{3}}" wx:key="{{index}}"> <swiper-item class="item"> <image class="itemimg {{currentindex == index ? 'active': ''}}" src="../../../image/3.jpg"></image> </swiper-item> </block> </swiper>
wxss文件
/* carousel/index.wxss */ page{ background: #f7f7f7f7; } .imagecontainer{ width: 100%; height: 500rpx; background: #000; } .item{ height: 500rpx; } .itemimg{ position: absolute; width: 100%; height: 380rpx; border-radius: 15rpx; z-index: 5; opacity: 0.7; top: 13%; } .active{ opacity: 1; z-index: 10; height: 430rpx; top: 7%; transition:all .2s ease-in 0s; }
js文件
// carousel/index.js page({ data: { currentindex: 0 }, onload: function (options) { }, /* 这里实现控制中间凸显图片的样式 */ handlechange: function(e) { this.setdata({ currentindex: e.detail.current }) }, })
总结
以上所述是小编给大家介绍的微信小程序使用swiper组件实现类3d轮播图,希望对大家有所帮助
如对本文有疑问,请在下面进行留言讨论,广大热心网友会与你互动!! 点击进行留言回复
利用JavaScript更改input中radio和checkbox样式
网友评论