码迷,mamicode.com
首页 > 其他好文 > 详细

Vue实现靠边悬浮球(PC端)

时间:2020-05-09 01:07:34      阅读:597      评论:0      收藏:0      [点我收藏+]

标签:log   height   false   cursor   nbsp   amp   ansi   logo   margin   

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

实现是这个样子:

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

 

技术图片

技术图片

 

 

 

嗯,具体代码:

  <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

                uploadShow: false,
                uploadflag: true,

js方法

  uploadenter() {
                this.uploadflag = true;
            },
            uploadleave() {
                this.uploadflag = false;

            },
            uploadanimated() {
                setTimeout(() => {
                    this.uploadShow = true;
                    setTimeout(() => {
                        this.uploadleave();
                    }, 1000);
                }, 1000);
            },

css

  .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端)

标签:log   height   false   cursor   nbsp   amp   ansi   logo   margin   

原文地址:https://www.cnblogs.com/liruilong/p/12853877.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!