• 实现轮播图滑到当前位置放大的效果(使用的是vantUI库)


    实现上图所示的轮播图的效果
    html:

      <div class="swiper-scale-wrap">

        <van-swipe class="swiper-block" :loop="true" :width="160" @change="onChange">
          <van-swipe-item class="swiper-item" :class="{'active': index == activeIndex}" v-for="(item, index) in swiperList" :key="item.id">
            <img :src="item.img" alt="">
          </van-swipe-item>
        </van-swipe>
      </div>
     
    JS:
      export default {
        data () {
          return {
            swiperList: [
              {
                id: '0',
                title: '图一',
                img: require('@/assets/img/bg_movement.png'),
              },
              {
                id: '1',
                title: '图二',
                img: require('@/assets/img/bg_sugar.png')
              },
              {
                id: '2',
                title: '图三',
                img: require('@/assets/img/bg_diet.png')
              },
              {
                id: '3',
                title: '图四',
                img: require('@/assets/img/bg_blood.png')
              }
            ]
            activeIndex: 0
          }
        },
        methods: {
          onChange (index) {
            this.activeIndex = index
          }
        }
      }
     
    CSS: --> 用的less 
      .swiper-scale-wrap{
        padding: .4rem .15rem;
        box-sizing: border-box;
        height: 300px;
        .swiper-block{
          height: 200px;
          .swiper-item{
            display: flex;
            justify-content: center;
            align-items: center;
            img{
               120px;
              height: 140px;
              display: block;
            }
          }
          .active{
            transform: scale(1.4);
            transition: all .2s ease-in 0s;
            z-index: 20;
          }
        }
      }
  • 相关阅读:
    C++——修改gcc版本优先级,多版本gcc共存
    C++——pic 与PIC的异同
    Java源码执行顺序
    ubuntu开机鼠标键盘没反应
    加载动态库失败
    ubuntu 重启网络
    交叉编译iperf3
    查看动态库的函数名
    UI组件Kendo UI for jQuery数据管理入门指南 TaskBoard/列
    B/S端界面控件DevExtreme ASP.NET MVC入门指南 调用方法
  • 原文地址:https://www.cnblogs.com/qianxiaoniantianxin/p/14453430.html
Copyright © 2020-2023  润新知