小程序 旋转木马_基于原生的小程序轮播图-旋转木马效果

旋转木马效果

13bfb4cafafdaf19e56575a98ae132c6.png

wxml代码

        这里内容布局{{index+1}}      

js代码

const app = getApp()Page({  data: {    baseRes: app.globalData.baseRes,    imgUrls: ["https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=2796939370,1206402153&fm=26&gp=0.jpg", "https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=3044936332,3482263290&fm=15&gp=0.jpg", "https://ss1.bdstatic.com/70cFvXSh_Q1YnxGkpoWK1HF6hhy/it/u=3914974861,2067249766&fm=26&gp=0.jpg", "https://ss3.bdstatic.com/70cFv8Sh_Q1YnxGkpoWK1HF6hhy/it/u=2546781936,2858567599&fm=26&gp=0.jpg"],    indicatorDots: true,    autoplay: true,    interval: 5000,    duration: 1000,    cardNum: 2,    swiperIndex: 0  },  bindchange: function(e) {    this.setData({      swiperIndex: e.detail.current    })  },})

wxss代码

.swiper {  height: 674rpx;  margin-top: 74rpx;}.back {  border-radius: 10rpx;}.center {  display: flex;  justify-content: center;  align-items: center;  width: 600rpx !important;  height: 544rpx !important;  overflow: visible;}/* .wrap{ position: relative; margin: 0 10rpx; } */.text, .html {  position: absolute;  right: 0;  top: 50%;  width: 100%;  text-align: center;  color: #fff;}.aplyCard {  width: 520rpx;  height: 90rpx;  text-align: center;  color: #fff;  background: #fe691f;  line-height: 90rpx;  font-size: 32rpx;  margin: 228rpx auto 80rpx;  border-radius: 50rpx;  box-shadow: 0 2rpx 10rpx #ff6315;}.noCard {  display: flex;  flex-direction: column;  align-items: center;}.noCard image {  width: 198rpx;  height: 232rpx;  margin: 124rpx 0 0;}.noCard view {  margin: 150rpx 0 32rpx;  width: 248rpx;  height: 70rpx;  color: #fff;  background: #ff6315;  font-size: 28rpx;  text-align: center;  line-height: 70rpx;  border-radius: 10rpx;}.noCard text {  color: #909090;  font-size: 22rpx;}swiper .wx-swiper-dots.wx-swiper-dots-horizontal {  margin-bottom: 2rpx;}swiper .wx-swiper-dot {  width: 28rpx;  display: inline-flex;  height: 6rpx;  margin-left: 10rpx;  justify-content: space-between;}swiper .wx-swiper-dot::before {  content: '';  flex-grow: 1;  background: #e6e6e6;  border-radius: 8rpx;}swiper .wx-swiper-dot-active::before {  background: #fa832d;}swiper image.cradBg {  transition: all 0.1s;  box-shadow: 0 20rpx 50rpx rgba(219, 218, 219, 0.3);  margin-top: 20rpx;}swiper image.cradBg.active {  width: 600rpx !important;  height: 544rpx !important;}swiper image.cradBg.quiet {  height: 500rpx;  width: 560rpx;}.brandLogo image {  width: 60rpx;  height: 60rpx;  border-radius: 100%;  margin-top: 19rpx;}.brandLogo {  width: 100rpx;  height: 100rpx;  border-radius: 100%;  background: rgba(255, 255, 255, 0.8);  text-align: center;}.txtBox {  position: absolute;  z-index: 1;  width: 100%;  height: 100%;  top: 0;  display: flex;  flex-direction: column;  align-items: center;  padding-top: 44rpx;  box-sizing: border-box;  color: #fff;}.plateNum {  font-size: 30rpx;  margin-top: 20rpx;  letter-spacing: 1.6rpx;}.color_ {  opacity: 0.8;}.line {  height: 2rpx;  width: 534rpx;  background: rgba(255, 255, 255, 0.2);  margin: 40rpx 0;}.carType {  font-size: 22rpx;}.carShop {  font-size: 30rpx;}.cardNum {  margin: 22rpx 0 18rpx;  display: block;}.name {  font-size: 24rpx;}
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
旋转木马轮播图是一种常见的网页设计效果,可以通过HTML、CSS和JavaScript来实现。根据提供的引用内容,可以看出旋转木马轮播图的实现主要是通过点击向左和向右按钮来改变旋转角度,从而实现图片的切换效果。 具体实现步骤如下: 1. 首先,在HTML中创建一个包含图片的容器,可以使用`<div>`元素,并为其设置一个唯一的ID,比如`haha`。 2. 使用CSS来设置容器的样式,包括宽度、高度、位置等,以及设置容器内图片的样式,比如设置宽度、高度、边框等。 3. 在JavaScript中,通过获取向左和向右按钮的元素,并为其添加点击事件监听器。 4. 在点击向左按钮事件的监听器中,通过改变旋转角度的值来实现向左旋转效果,可以使用`transform`属性和`rotateY()`函数来实现。 5. 在点击向右按钮事件的监听器中,通过改变旋转角度的值来实现向右旋转效果,同样使用`transform`属性和`rotateY()`函数。 6. 最后,通过修改容器的样式,将旋转角度应用到容器上,从而实现图片的旋转效果。 需要注意的是,具体的实现可能还需要根据实际需求进行调整和优化,比如添加过渡效果、自动播放等。 综上所述,通过点击向左和向右按钮来改变旋转角度,可以实现HTML旋转木马轮播图效果。 #### 引用[.reference_title] - *1* *2* *3* [旋转木马轮播图 html+css+js](https://blog.csdn.net/luo1831251387/article/details/115150938)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值