我是靠谱客的博主 真实小蝴蝶,这篇文章主要介绍Vue实现PC端靠边悬浮球的代码,现在分享给大家,希望可以做个参考。

我想把退出登录的按钮做成一个悬浮球的样子,带动画的那种。

实现是这个样子:

手边没有球形图。随便找一个,功能这里演示的为单机悬浮球注销登录

嗯,具体代码:

复制代码
1
2
3
4
5
6
7
8
9
<div :class="['meun-switch animated flex-row',uploadflag ? 'active rubberBand off' : 'leave jello']" @mouseleave="uploadleave" @mouseenter="uploadenter" v-if="uploadShow" @click.stop="logout" > <img :src="require('@/assets/1.png')"/> </div>

data

复制代码
1
2
uploadShow: false, uploadflag: true,

js方法

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
uploadenter() { this.uploadflag = true; }, uploadleave() { this.uploadflag = false; }, uploadanimated() { setTimeout(() => { this.uploadShow = true; setTimeout(() => { this.uploadleave(); }, 1000); }, 1000); },

css

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
.off{ -webkit-animation:1s seconddiv; background: transparent; } @keyframes seconddiv{ 0% {transform: scale(1.4,1.4);} 10% {transform: scale(1,1);} 25% {transform: scale(1.2,1.2);} 50% {transform: scale(1,1);} 70% {transform: scale(1.2,1.2);} 100% {transform: scale(1,1);} } .meun-switch { position: fixed; top: 90px; left: 0px; z-index: 2001; cursor: pointer; width: 150px; height: 150px; padding: 5px; transition: all 0.25s; &.leave { left: -65px; } &.active { left: 0; } &:hover { transform: scale(1.02); } img { width: 120px; height: 120px; } }

总结

到此这篇关于Vue实现PC端靠边悬浮球的代码的文章就介绍到这了,更多相关Vue靠边悬浮球内容请搜索靠谱客以前的文章或继续浏览下面的相关文章希望大家以后多多支持靠谱客!

最后

以上就是真实小蝴蝶最近收集整理的关于Vue实现PC端靠边悬浮球的代码的全部内容,更多相关Vue实现PC端靠边悬浮球内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(191)

评论列表共有 0 条评论

立即
投稿
返回
顶部