微信小程序:轮播图中间大两边小、中间放大高亮显示

//wxml
<view class="swiper-wrapper">
    <swiper 
      indicator-dots="{
   {true}}"
      indicator-color="rgba(221,0,34,.3)"
      indicator-active-color="#DD0022"
      autoplay="{
   {false}}" 
      interval="{
   {5000}}" 
      duration="{
   {500}}"
      current="{
   {posterList.length>2?1:0}}"
      previous-margin="96rpx"
      next-margin="96rpx"
      bindchange="swiperChange"
    >
      <block wx:for="{
   {posterList}}" wx:key="*this">
        <swiper-item>
          <view class="swiper-item {
   {currentIndex==index?'swiper-item-active':''}}">
            <image class="" src="{
   {item.image}}" mode="scaleToFill" />
          </view>
        </swiper-item>
      </block>
    </swiper>
  </view>

//js
data: {
    currentIndex: 0,
    posterList: [
      {
        id: '1', 
        image: 'https://mina.qn.woody.club/%E8%87%B3%E5%B0%8A%E5%8D%A11.png'
      },
      {
        id: '2', 
        image: 'https://mina.qn.woody.club/%E8%87%B3%E5%B0%8A%E5%8D%A12.png'
      },
      {
        id: '3', 
        image: 'https://mina.qn.woody.club/%E4%BA%B2%E5%AD%90%E5%8D%A11.png'
      },
      {
        id: '4', 
        image: 'https://mina.qn.woody.club/%E4%BA%B2%E5%AD%90%E5%8D%A12.png'
      },
    ]
  },
//函数
swiperChange(event){
    let {current} = event.detail;
    this.setData({
      currentIndex: current
    })
  },

 

//wxss
.swiper-wrapper{
  flex: 1;
  width: 750rpx;
  padding-top: 80rpx;
  margin: 0 auto;
}
swiper{
  width: 750rpx;
  height: 900rpx;
}

.swiper-item{
  height: 900rpx;
  display: flex;
  align-items: center;
}

.swiper-item image{
  width: 448rpx;
  height: 720rpx;
  margin: 0 auto;
  border-radius: 20rpx;
  transition: all 0.6s;
}
.swiper-item-active image{
  width: 560rpx;
  height: 900rpx;
  transition: all 0.6s;
}

相关推荐

  1. uniapp实现两边

    2023-12-21 09:30:03       38 阅读
  2. 程序九宫格布局,

    2023-12-21 09:30:03       64 阅读
  3. 程序实现

    2023-12-21 09:30:03       37 阅读
  4. 程序

    2023-12-21 09:30:03       30 阅读
  5. 程序 且跳转公众号文章

    2023-12-21 09:30:03       47 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2023-12-21 09:30:03       94 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2023-12-21 09:30:03       100 阅读
  3. 在Django里面运行非项目文件

    2023-12-21 09:30:03       82 阅读
  4. Python语言-面向对象

    2023-12-21 09:30:03       91 阅读

热门阅读

  1. Android开发中,百度语音集成之一

    2023-12-21 09:30:03       50 阅读
  2. 小程序完结总结

    2023-12-21 09:30:03       50 阅读
  3. 【Linux基本指令(2)】

    2023-12-21 09:30:03       59 阅读
  4. 深度学习中聚类的“类”指的是什么

    2023-12-21 09:30:03       58 阅读
  5. 小程序常用实用例子

    2023-12-21 09:30:03       56 阅读
  6. oppo 手机刷机流程

    2023-12-21 09:30:03       69 阅读
  7. BC115超级圣诞树

    2023-12-21 09:30:03       66 阅读
  8. 【算法题】2. 两数相加

    2023-12-21 09:30:03       60 阅读
  9. DjangoRestFramework(drf实现五个接口)

    2023-12-21 09:30:03       51 阅读
  10. 正则表达式:掌握文本处理的秘密武器

    2023-12-21 09:30:03       55 阅读
  11. sql_lab之sqli中的post注入

    2023-12-21 09:30:03       49 阅读