Vue實現靠邊懸浮球(PC端)

我想把退出登陸的按鈕作成一個懸浮球的樣子,帶動畫的那種。css

實現是這個樣子:web

手邊沒有球形圖。隨便找一個,功能這裏演示的爲單機懸浮球註銷登陸flex

 

 

 

 

嗯,具體代碼:動畫

  <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>

dataui

                uploadShow: false,
                uploadflag: true,

js方法this

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

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

cssspa

  .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;
        }
    }
   
相關文章
相關標籤/搜索