微信小程序 实现图片左右滑动 点击切换

  • 效果图
  • 结构部分
<view class="swiperItem1"><view class="workTitle">请您添加中石油服务经理企业微信</view><view class="workTitle">参与活动</view><view class="workSubTitle">添加操作</view><view class="workClickBelow">点击下方“立即添加”按钮</view><view class="workClickBelowBtn" bindtap="jumpWorkWechatFuc"></view></view><view class="swiper-box" style="display: {{workerdisplay}}"><swiper current="{{currentNum}}" bindchange='onChange' class="swiper-item"><swiper-item bindtap="change" data-id="1" ><view class="swiper-item_box"><!-- <image src="https://static.sprucesmart.com/hainanapp/firstStep1-min.png"></image> --><image src="https://static.sprucesmart.com/hainanapp/firstStep2-min.png"></image></view></swiper-item><swiper-item bindtap="change" data-id="2" ><view class="swiper-item_box"><!-- <image src="https://static.sprucesmart.com/hainanapp/secondSteps1-min.png"></image> --><image src="https://static.sprucesmart.com/hainanapp/secondSteps2-min.png"></image></view></swiper-item></swiper></view><view class="closeWorkToast" bindtap="closeworkerpopFuc"></view>
  • 样式
swiper {/* height: 750rpx; */display: flex;flex-flow: column;align-items: center;z-index: 99999999;
}
.swiperItem1 {width: 570rpx;height: 780rpx;background: url(https://static.sprucesmart.com/hainanapp/workshowbg3-min.png)no-repeat center;background-size: 100% 100%;padding-top: 30rpx;box-sizing: border-box;position: absolute;z-index: 9;top: 276rpx;left: 90rpx;
}.swiper-box {width: 570rpx;height: 366rpx;position: absolute;z-index: 9;top: 657rpx;left: 91rpx;
}
.swiper-img {width: 570rpx;height: 750rpx;
}.swiper-img-active1 {width: 570rpx;height: 750rpx;background: url(https://static.sprucesmart.com/hainanapp/workshowbg1-min.png)no-repeat center;background-size: 100% 100%;padding-top: 30rpx;box-sizing: border-box;
}.workTitle {font-size: 32rpx;font-family: Alibaba PuHuiTi;font-weight: bold;color: #ffffff;text-shadow: 0rpx 2rpx 0rpx #ac4801;text-align: center;
}
.workSubTitle {font-size: 30rpx;font-family: PingFang SC;font-weight: 500;color: #ffffff;text-align: center;
}.workClickBelow {font-size: 30rpx;font-family: PingFang SC;font-weight: 500;color: #2c3f53;text-align: center;margin-top: 66rpx;
}
.workClickBelowBtn {width: 409rpx;height: 74rpx;background: url(https://static.sprucesmart.com/hainanapp/workClickBelowBtn-min.png)no-repeat center;background-size: 100% 100%;text-align: center;margin: 17rpx auto 0;
}
.firstStep {width: 116rpx;height: 38rpx;background: url(https://static.sprucesmart.com/hainanapp/firstStep-min.png)no-repeat center;background-size: 100% 100%;margin: 0 227rpx;
}
.secondStep {width: 116rpx;height: 38rpx;background: url(https://static.sprucesmart.com/%20hainanapp/secondStep-min.png)no-repeat center;background-size: 100% 100%;margin: 0 227rpx;
}
.eWTltle {font-size: 28rpx;font-family: PingFang SC;font-weight: 500;color: #2c3f53;line-height: 30px;margin: 0 auto 38rpx;text-align: center;
}
.closeWorkToast {width: 60rpx;height: 60rpx;background: url(https://static.sprucesmart.com/hbMayDay/closeicon.png);background-size: 100% 100%;position: absolute;/* left: 246rpx;top: 800rpx; */color: #fff;left: 343rpx;top: 1100rpx;z-index: 9999999999;
}
.swiperItem2 {width: 570rpx;height: 750rpx;background: url(https://static.sprucesmart.com/hainanapp/workshowbg2-min.png)no-repeat center;background-size: 100% 100%;padding-top: 30rpx;box-sizing: border-box;
}
.swiper-item_box {width: 100%;height: 100%;margin-left: 5rpx;border: none;/* width: 559rpx;height: 333rpx; */
}
.swiper-item_box image {width: 100%;height: 100%;
}.swiper-item {width: 570rpx !important;height: 366rpx !important;
}
  • js部分
data: {currentNum: 0
},// 监听轮播onChange(e) {this.setData({currentNum: e.detail.current,})},change(e) {var id = e.currentTarget.dataset.id;if (id == 1) {this.setData({currentNum: 1,})} else {this.setData({currentNum: 0,})}},

图片整体滑动

- 结构<view class="swiper-box" style="display: {{workerdisplay}}"><swiper current="{{currentNum}}" bindchange='onChange'><swiper-item bindtap="change" data-id="1"><view class="swiperItem1"><view class="workTitle">请您添加中石油服务经理企业微信</view><view class="workTitle">参与活动</view><view class="workSubTitle">添加操作</view><view class="workClickBelow">点击下方“立即添加”按钮</view><view class="workClickBelowBtn"></view><view class="firstStep"></view><view class="eWTltle">在页面中长按识别二维码添加企业微信</view></view></swiper-item><swiper-item bindtap="change" data-id="2"><view class="swiperItem2"><view class="workTitle">请您添加中石油服务经理企业微信</view><view class="workTitle">参与活动</view><view class="workSubTitle">添加操作</view><view class="workClickBelow">点击下方“立即添加”按钮</view><view class="workClickBelowBtn" ></view><view class="firstStep"></view><view class="eWTltle">在页面中长按识别二维码添加企业微信</view></view></swiper-item></swiper><view class="closeWorkToast" bindtap="closeworkerpopFuc"></view></view>
-样式
/* 添加站经理弹窗 */
swiper {height: 750rpx;display: flex;flex-flow: column;align-items: center;z-index: 99999999;
}
.swiperItem1 {width: 570rpx;height: 750rpx;background: url(https://static.sprucesmart.com/hainanapp/workshowbg1-min.png)no-repeat center;background-size: 100% 100%;padding-top: 30rpx;box-sizing: border-box;
}.swiper-box {width: 100%;/* height: 100%; */position: absolute;z-index: 9;top: 276rpx;left: 90rpx;
}
.swiper-img {width: 570rpx;height: 750rpx;
}.swiper-img-active1 {width: 570rpx;height: 750rpx;background: url(https://static.sprucesmart.com/hainanapp/workshowbg1-min.png)no-repeat center;background-size: 100% 100%;padding-top: 30rpx;box-sizing: border-box;
}.workTitle {font-size: 32rpx;font-family: Alibaba PuHuiTi;font-weight: bold;color: #ffffff;text-shadow: 0rpx 2rpx 0rpx #ac4801;text-align: center;
}
.workSubTitle {font-size: 30rpx;font-family: PingFang SC;font-weight: 500;color: #ffffff;text-align: center;
}.workClickBelow {font-size: 30rpx;font-family: PingFang SC;font-weight: 500;color: #2c3f53;text-align: center;margin-top: 66rpx;
}
.workClickBelowBtn {width: 409rpx;height: 74rpx;background: url(https://static.sprucesmart.com/hainanapp/workClickBelowBtn-min.png)no-repeat center;background-size: 100% 100%;text-align: center;margin: 17rpx auto 56rpx;
}
.firstStep {width: 116rpx;height: 38rpx;background: url(https://static.sprucesmart.com/hainanapp/firstStep-min.png)no-repeat center;background-size: 100% 100%;margin: 0 227rpx;
}
.eWTltle {font-size: 28rpx;font-family: PingFang SC;font-weight: 500;color: #2c3f53;line-height: 30px;margin: 0 57rpx 10rpx 38rpx;text-align: center;
}
.closeWorkToast {width: 60rpx;height: 60rpx;background: url(https://static.sprucesmart.com/hbMayDay/closeicon.png);background-size: 100% 100%;position: absolute;left: 246rpx;top: 800rpx;color: #fff;
}
.swiperItem2 {width: 570rpx;height: 750rpx;background: url(https://static.sprucesmart.com/hainanapp/workshowbg2-min.png)no-repeat center;background-size: 100% 100%;padding-top: 30rpx;box-sizing: border-box;
}

微信小程序 图片左右滑动 swiper相关推荐

  1. 微信小程序利用scroll-view和swiper实现图片滚动切换

    微信小程序利用scroll-view和swiper实现图片滚动切换 <view class="starbox"><view class="starare ...

  2. 微信小程序图片轮转播放

    微信小程序图片轮播 步骤一:创建项目,注意创建的路径,路径中涉及到的文件最好用英文命名. 这里将项目创建在D:\SotfWare\WechatPG\test1.test1是项目的文件名.创建结束之后, ...

  3. 微信小程序-tab左右滑动切换

    微信小程序-tab左右滑动切换 一.简介 1.核心思想 二.实现 1.wxml实现 2.js实现 3.wxss实现 三.参考和总结 四.优化 0.效果图 1.每个tab长度自适应 2.先前隔tab点击 ...

  4. 微信小程序 - 实现左滑动删除功能

    微信小程序 - 实现左滑动删除功能 效果图: 实现过程: 一.wxml布局 这里我是先用了一个大盒子包裹小盒子,然后小盒子里面进行左右布局(左边为内容部分,右边为删除按钮)的方式实现的 <vie ...

  5. 小程序 图片上传php后台,微信小程序图片选择、上传到服务器、预览(PHP)实现实例...

    微信小程序图片选择.上传到服务器.预览(php)实现实例 小程序实现选择图片.预览图片.上传到开发者服务器上 后台使用的tp3.2 图片上传 请求时候的header参考时可以去掉(个人后台验证权限使用 ...

  6. php 点击选择图片上传,微信小程序图片选择、上传到服务器、预览(PHP)实现实例...

    微信小程序图片选择.上传到服务器.预览(PHP)实现实例 小程序实现选择图片.预览图片.上传到开发者服务器上 后台使用的tp3.2 图片上传 请求时候的header参考时可以去掉(个人后台验证权限使用 ...

  7. 微信小程序图片上传九宫格拖拽组件

    微信小程序图片上传&九宫格拖拽组件 前言 图片上传加九宫格拖拽是一个比较常用的组件,常用于发帖或者评论等内容上传模块,我这篇九宫格拖拽的思路是借鉴了一款优雅的小程序拖拽排序组件实现这篇文章 实 ...

  8. 微信小程序图片裁剪插件image-cropper

    image-cropper 一款高性能的微信小程序图片裁剪插件,支持旋转.设置尺寸 功能亮点 1.支持旋转支持旋转支持旋转. 2.性能超高超流畅,大图毫无卡顿感. 3.可以设置导出图片尺寸. 4.自由 ...

  9. 微信小程序图片(头像)裁剪工具we-cropper含2d版-完整版

    微信小程序图片(头像)裁剪工具we-cropper含2d版-完整版 本教程基于 we-cropper v1.4.0,非本人同意禁止任何形的转载 we-cropper官方下载链接 效果图 一.非2d版 ...

最新文章

  1. 2021中国国际消费电子博览会和青岛国际软件融合创新博览会盛大开幕
  2. 用C语言解“两个数的简单计算器”题
  3. python生词本的生词_【Anki小工具】有道生词本转Anki 1.0
  4. 将Maven与Ivy集成
  5. Jsoup设置属性值
  6. 打造个人专属的微型linux--启动原理篇
  7. Oracle11g客户端安装配置
  8. 顺序查找、折半查找、索引查找
  9. windows连接linux
  10. ubuntu16中,google浏览器安装OneNote Web Clipper插件
  11. CUDA10.0网盘下载
  12. (解读)什么是渗透测试(Penetration Testing)?
  13. 镭速关于高速数据传输的介绍!
  14. MYSQL 文件目录,数据库的存储文件目录
  15. vue+elementui 同时有上传文件和批量上传文件功能,上传文件或批量上传文件后必须刷新才能再次上传文件
  16. 【学习笔记】状态转移矩阵
  17. 博客之星活动改进建议
  18. jBox2D v2.0.1 用户手册
  19. Foursquare
  20. C. Slay the Dragon

热门文章

  1. 算力≠智慧! MIT教授抛出「意识来源」新理论:人类认知与计算根本没关系
  2. 徐工汉云解析中小企业如何设备上云?
  3. 这家公司把裁员写进OKR,脸都不要了
  4. 凡科建站产品体验报告
  5. 商品交易系统之---产品介绍
  6. 【观察】智能决策:从中国制造到中国智造的通关“金钥匙”
  7. 摩拜再裁员:主要面对亚太地区
  8. 【逻辑漏洞技巧拓展】————3、逻辑漏洞之密码重置
  9. java.lang.NoClassDefFoundError: Could not initialize class错误原因
  10. 【python】小技巧-判断一个字典中是否包含另一个字典的值,即实际结果中是否包含预期结果