优化悬浮按钮样式
This commit is contained in:
@@ -1,20 +1,20 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="floating-btn">
|
<div class="floating-btn">
|
||||||
<div class="btns-inner">
|
<div class="btns-inner">
|
||||||
<div class="btn" title="折叠侧边菜单" @click="toggleSideCollapse()">
|
<button class="btn" type="button" title="折叠侧边菜单" @click="toggleSideCollapse()">
|
||||||
<i class="el-icon-menu" aria-hidden="true"></i>
|
<i class="el-icon-menu" aria-hidden="true"></i>
|
||||||
</div>
|
</button>
|
||||||
<div class="btn" title="刷新" @click="refreshPage()">
|
<button class="btn" type="button" title="刷新" @click="refreshPage()">
|
||||||
<i class="el-icon-refresh-right" aria-hidden="true"></i>
|
<i class="el-icon-refresh-right" aria-hidden="true"></i>
|
||||||
</div>
|
</button>
|
||||||
<div class="btn" title="返回主页" @click="backToHome()">
|
<button class="btn" type="button" title="返回主页" @click="backToHome()">
|
||||||
<i class="el-icon-s-home" aria-hidden="true"></i>
|
<i class="el-icon-s-home" aria-hidden="true"></i>
|
||||||
</div>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="btns-outer">
|
<div class="btns-outer">
|
||||||
<div class="btn" title="悬浮菜单">
|
<button class="btn" type="button" title="菜单">
|
||||||
<i class="fa fa-bars" aria-hidden="true"></i>
|
<i class="fa fa-bars" aria-hidden="true"></i>
|
||||||
</div>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -27,8 +27,28 @@ export default {
|
|||||||
config: this.$root.config.storage
|
config: this.$root.config.storage
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
mounted () {
|
||||||
|
this.initAnimation();
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置动画
|
||||||
|
*/
|
||||||
|
initAnimation() {
|
||||||
|
var btns = document.querySelectorAll('.floating-btn .btn');
|
||||||
|
var className = 'animate';
|
||||||
|
|
||||||
|
btns.forEach((elem) => {
|
||||||
|
elem.onclick = function () {
|
||||||
|
this.classList.remove(className);
|
||||||
|
setTimeout(() => {
|
||||||
|
this.classList.add(className);
|
||||||
|
}, 20);
|
||||||
|
};
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 返回主页
|
* 返回主页
|
||||||
*/
|
*/
|
||||||
@@ -80,9 +100,9 @@ export default {
|
|||||||
|
|
||||||
&:hover {
|
&:hover {
|
||||||
.btns-inner .btn {
|
.btns-inner .btn {
|
||||||
width: 2.5rem;
|
width: 2.6rem;
|
||||||
height: 2.5rem;
|
height: 2.6rem;
|
||||||
font-size: 0.9rem;
|
font-size: 1rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -95,7 +115,8 @@ export default {
|
|||||||
height: 0;
|
height: 0;
|
||||||
background-color: @colorSecondary;
|
background-color: @colorSecondary;
|
||||||
font-size: 0;
|
font-size: 0;
|
||||||
transition: all calc(@transitionTime * 1.2);
|
transition: all calc(@transitionTime * 1.6),
|
||||||
|
font-size calc(@transitionTime * 0.8);
|
||||||
|
|
||||||
&:not(:first-child) {
|
&:not(:first-child) {
|
||||||
margin-top: 0.75rem;
|
margin-top: 0.75rem;
|
||||||
@@ -108,8 +129,8 @@ export default {
|
|||||||
|
|
||||||
.btn {
|
.btn {
|
||||||
margin-top: 1rem;
|
margin-top: 1rem;
|
||||||
width: 3rem;
|
width: 3.2rem;
|
||||||
height: 3rem;
|
height: 3.2rem;
|
||||||
background-color: @colorPrimary;
|
background-color: @colorPrimary;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -130,21 +151,50 @@ export default {
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
||||||
&::after {
|
&::before, &::after {
|
||||||
content: "";
|
content: "";
|
||||||
display: block;
|
display: block;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 0;
|
top: 50%;
|
||||||
left: 0;
|
left: 50%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
border-radius: 50%;
|
||||||
background-color: #FFF;
|
background-color: #FFF;
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
transition: opacity @transitionTime
|
transition: opacity @transitionTime;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
}
|
}
|
||||||
|
|
||||||
&:hover::after {
|
&:hover::before {
|
||||||
|
opacity: 0.1;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.animate::after {
|
||||||
|
animation: floatingBtnClick 0.5s linear;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes floatingBtnClick {
|
||||||
|
0% {
|
||||||
|
width: 0;
|
||||||
|
height: 0;
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
|
25% {
|
||||||
opacity: 0.2;
|
opacity: 0.2;
|
||||||
}
|
}
|
||||||
|
50% {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
75% {
|
||||||
|
opacity: 0.2;
|
||||||
|
}
|
||||||
|
100% {
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
opacity: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
Reference in New Issue
Block a user