vue有意思的图片动画插件direction-reveal

news/2024/12/21 13:19:34/

功能:操作简单好上头,动画特效很丝滑,有很多种供选择

1.下载插件

npm install direction-reveal --save-dev

2.使用

导入到需要使用动画的单页面

import DirectionReveal from 'direction-reveal';

使用样式

    mounted() {this.query();},methods: {query() {const directionRevealDemo = DirectionReveal();const directionRevealDefault = DirectionReveal({selector: '.direction-reveal',itemSelector: '.direction-reveal__card',animationName: 'swing',animationPostfixEnter: 'enter',animationPostfixLeave: 'leave',enableTouch: true,touchThreshold: 250});// 旋转const directionRevealRotate = DirectionReveal({selector: '.direction-reveal--demo-rotate',itemSelector: '.direction-reveal__card',animationName: 'rotate',animationPostfixEnter: 'enter',animationPostfixLeave: 'leave',enableTouch: true,touchThreshold: 250});// 图片翻转const directionRevealFlip = DirectionReveal({selector: '.direction-reveal--demo-flip',animationName: 'flip'});}}

导入css,如果用到了scss就导入scss,用的css就导入.css文件

<style lang="scss" scoped>
@import '/node_modules/direction-reveal/src/styles/direction-reveal.scss';

3.完整代码

<template><div class="content-box"><div class="container"><div class="direction-reveal direction-reveal--3-grid direction-reveal--demo-swing"><a href="#" class="direction-reveal__card"><img src="../../assets/img/img.jpg" alt="Image" class="img-fluid" /><div class="direction-reveal__overlay direction-reveal__anim--enter"><h3 class="direction-reveal__title">Title</h3><p class="direction-reveal__text">Description text.</p></div></a><a href="#" class="direction-reveal__card"><img src="../../assets/img/img.jpg" alt="Image" class="img-fluid" /><div class="direction-reveal__overlay direction-reveal__anim--enter"><h3 class="direction-reveal__title">标题内容区域</h3><p class="direction-reveal__text">Description text.</p></div></a><a href="#" class="direction-reveal__card"><img src="../../assets/img/img.jpg" alt="Image" class="img-fluid" /><div class="direction-reveal__overlay direction-reveal__anim--enter"><h3 class="direction-reveal__title">Title</h3><p class="direction-reveal__text">Description text.</p></div></a></div><!-- 旋转 --><div class="fullwidth"><div class="imgbox separator"><h3 class="">旋转</h3><div class="direction-reveal direction-reveal--3-grid direction-reveal--demo-rotate"><a href="#" class="direction-reveal__card"><img src="../../assets/img/img.jpg" alt="Image" class="direction-reveal__img" /><div class="direction-reveal__overlay direction-reveal__anim--enter"><h3 class="direction-reveal__title">Lorem ipsum</h3><p class="direction-reveal__text">内容区域</p></div></a><a href="#" class="direction-reveal__card"><img src="../../assets/img/img.jpg" alt="Image" class="direction-reveal__img" /><div class="direction-reveal__overlay direction-reveal__anim--enter"><h3 class="direction-reveal__title">Lorem ipsum</h3><p class="direction-reveal__text">内容区域</p></div></a><a href="#" class="direction-reveal__card"><img src="../../assets/img/img.jpg" alt="Image" class="direction-reveal__img" /><div class="direction-reveal__overlay direction-reveal__anim--enter"><h3 class="direction-reveal__title">Lorem ipsum</h3><p class="direction-reveal__text">内容区域</p></div></a></div></div></div><!-- 图片翻转 --><div class="fullwidth"><div class="container separator"><h3 class="">图片翻转</h3><div class="direction-reveal direction-reveal--3-grid direction-reveal--demo-flip"><a href="#" class="direction-reveal__card"><img src="../../assets/img/img.jpg" alt="Image" class="direction-reveal__anim--leave direction-reveal__img" /><div class="direction-reveal__overlay direction-reveal__anim--enter"><h3 class="direction-reveal__title">Lorem ipsum</h3><p class="direction-reveal__text">Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium, totamrem aperiam, eaque ipsa quae ab illo inventore eritatis et quasi.</p></div></a></div></div></div></div></div>
</template><script>
import DirectionReveal from 'direction-reveal';
export default {data() {return {};},mounted() {this.query();},methods: {query() {const directionRevealDemo = DirectionReveal();const directionRevealDefault = DirectionReveal({selector: '.direction-reveal',itemSelector: '.direction-reveal__card',animationName: 'swing',animationPostfixEnter: 'enter',animationPostfixLeave: 'leave',enableTouch: true,touchThreshold: 250});// 旋转const directionRevealRotate = DirectionReveal({selector: '.direction-reveal--demo-rotate',itemSelector: '.direction-reveal__card',animationName: 'rotate',animationPostfixEnter: 'enter',animationPostfixLeave: 'leave',enableTouch: true,touchThreshold: 250});// 图片翻转const directionRevealFlip = DirectionReveal({selector: '.direction-reveal--demo-flip',animationName: 'flip'});}}
};
</script><style lang="scss" scoped>
@import '/node_modules/direction-reveal/src/styles/direction-reveal.scss';
.container {border: 1px solid red;// flex-wrap: wrap;img {width: 100px;height: 100px;}.fullwidth {width: 600px;img {width: 200px;height: 200px;}}
}
</style>

5.效果

 6.插件地址

https://github.com/NigelOToole/direction-reveal

文章到此结束,希望对你有所帮助~


http://www.ppmy.cn/news/739103.html

相关文章

解决HP ProLiant DL380 G5的安装与启动CentOS7时不能识别raid硬盘问题

最近去机房给一台HP DL380G5重装操作系统时&#xff0c;发现CentOS7无法识别到硬盘&#xff0c;这台服务器做的raid1&#xff0c;有理由怀疑新系统无法支持老机器的raid卡&#xff0c;查了些资料在此做个记录。 一、无法识别的原因 参看&#xff1a; https://www.kernel.org/…

dell服务器SLOt3硬盘,dell和hp服务器磁盘检测命令

DELL检测工具 #/opt/MegaRAID/MegaCli/MegaCli64 -LDInfo -Lall -aALL 查raid级别 #/opt/MegaRAID/MegaCli/MegaCli64 -AdpAllInfo -aALL 查raid卡信息 #/opt/MegaRAID/MegaCli/MegaCli64 -PDList -aALL 查看硬盘信息 #/opt/MegaRAID/MegaCli/MegaCli64 -AdpBbuCmd -aAll 查看电…

戴尔计算机软件的安装,怎么安装dell电脑系统

先要做个系统分区.现在街上有卖那种GHOST XP的光盘,买一张回来,放到光驱里,启动的时候按着F12选择引导方式.选择从CD-ROM启动,然后进入光盘的启动界面,你可以选择MQ进行分区,可以照着系统的提示去做.分区完毕之后,再重新启动,同样选择光盘启动,进入GHOST界面,系统会自动GHOST. …

瘦客户机之战白热化 戴尔惠普纷纷祭出VDI硬件

就在前不久于旧金山召开的思杰Synergy 2012大会上&#xff0c;惠普宣布了一款新的零客户机(zero client)&#xff0c;戴尔则为其桌面虚拟化解决方案(DVS)系统添加了另一款虚拟桌面基础设施(VDI)组件。现在归属戴尔的慧智科技公司(Wyse Technology Inc.)也在近日发布了一款新的零…

惠普和戴尔加入IaaS云行列中来

惠普和戴尔都进入了IaaS云服务业务,建立基础设施在自己的服务器和OpenStack(HP)/ vCloud(戴尔)。 .戴尔的承诺来用两种基于窗口,云OpenStack蔚蓝。 HPHPannounced宣布their support of the他们的支持OpenStackOpenStackplatform in July of this year, joining some 100 othe…

raid 物理盘缓存状态_MegaCli 监控raid状态 限戴尔服务器

MegaCli是一款管理维护硬件RAID软件&#xff0c;可以通过它来了解当前raid卡的所有信息&#xff0c;包括 raid卡的型号&#xff0c;raid的阵列类型&#xff0c;raid 上各磁盘状态&#xff0c;等等。通常&#xff0c;我们对硬盘当前的状态不太好确定&#xff0c;一般通过机房人员…

戴尔服务器换盘及raid创建操作手册

ceph集群单个数据盘的raid方式不同&#xff08;单盘raid0、jbod、多盘raid0&#xff09;&#xff0c;所使用的服务器不同&#xff08;惠普、戴尔等&#xff09;&#xff0c;因此在换盘时&#xff0c;如何能让管理系统识别这个新盘&#xff0c;所需要的操作也不同&#xff0c;通…

解读戴尔,惠普和思科的“三角关系”

戴尔 众所周知&#xff0c;戴尔收购EMC&#xff0c;其中EMC组件部分包括EMC II&#xff0c;VMware&#xff0c;RSA&#xff0c;Pivotal和Virtustream&#xff0c;为戴尔提供多样化方式增益收入流&#xff0c;但对竞争可不是什么好兆头。 在这里要说的关键是营收多样化。戴尔因为…