当前位置:网站首页>v-for下定时给图片添加动画
v-for下定时给图片添加动画
2022-04-23 05:53:00 【Front 小思】
需求:在vue中v-for遍历图片列表依据index时定时给图片添加动画!
效果图:

.VUE
<div class="a01_header">
<img
v-for="(items,index) in a01_header"
:key="index"
:class="selectIndex == index ? 'add_animation':''"
:src=items.img_url />
</div>
.JS
data: {
a01_header: [
{
img_url: './img/01/imgs/a01.png'},
{
img_url: './img/01/imgs/a02.png'},
{
img_url: './img/01/imgs/a03.png'},
{
img_url: './img/01/imgs/a04.png'},
{
img_url: './img/01/imgs/a05.png'}
],
selectIndex:0
},
mounted: function() {
setInterval(() =>{
this.getMethon();
},2000)
},
getMethon(){
const {
a01_header } = this;
let len = a01_header.length,
index = this.selectIndex;
if (index + 1 == len) {
this.selectIndex = 0
} else {
this.selectIndex = index + 1;
}
}
.CSS
.add_animation{
animation: scaleBtn 2s infinite ease-in-out;
}
@keyframes scaleBtn {
0% {
transform: scale(1);
opacity: 1;
}
50% {
transform: scale(1.1);
}
100% {
transform: scale(1);
opacity: 1;
}
}
版权声明
本文为[Front 小思]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_45788691/article/details/123236280
边栏推荐
- SDOI2009-HH的项链
- 逻辑回归原理及代码实现
- [UDS unified diagnostic service] i. overview of diagnosis (4) - basic concepts and terms
- 赛氪-二进制
- 2022LDU寒假训练-程序补丁
- CUDA project encountered a series of compilation problems after changing the environment (computer)
- JS高频面试题
- ES6面试题(参考文档)
- undefined reference to `Nabo::NearestNeighbourSearch
- 锚点定位——如何设置锚点居页面顶部距离,锚点定位并距离顶部一定偏移
猜你喜欢

QT icon application

基于TensorFlow的线性回归实例

HDU-Tunnel Warfare

卷积神经网络实现CIFAR100数据集分类
![[UDS unified diagnosis service] IV. typical diagnosis service (1) - diagnosis and communication management function unit](/img/4f/7ca6505b545fb825b0dba36f474da7.png)
[UDS unified diagnosis service] IV. typical diagnosis service (1) - diagnosis and communication management function unit

js获取链接?后边的参数名称或者值,根据url ?后的参数做判断

【UDS统一诊断服务】(补充)五、ECU bootloader开发要点详解 (2)
逻辑回归原理及代码实现

三极管原理及特性分析
![[UDS unified diagnostic service] II. Network layer protocol (1) - overview and functions of network layer](/img/39/30bb897ff4467105de08c8c1c737ab.png)
[UDS unified diagnostic service] II. Network layer protocol (1) - overview and functions of network layer
随机推荐
cartographer_node 编译没问题,但是运行直接挂掉的bug
汇编基础代码示例
Using printf in MFC
猜數字遊戲
[UDS unified diagnosis service] IV. typical diagnosis service (1) - diagnosis and communication management function unit
Notes on advanced points of C language 5
sqlite3加密版
往String原型上封装一个时间戳转日期的方法
[UDS unified diagnostic service] IV. typical diagnostic service (5) - function / component test function unit (routine function unit 0x31)
QT add qserialport class to realize serial port operation
HDU-Memory Control
Quaternion multiplication
HDU-Memory Control
【UDS统一诊断服务】一、诊断概述(1)— 诊断概述
基于TensorFlow的线性回归实例
VHDL-任意分频器(50%占空比)
POJ-The Unique MST
[opencv] use filestorage to read and write eigenvectors
Matching between class template with default template argument and template parameter
Introduction and application of WMI Technology