vue简易指引用户向下翻阅悬浮效果箭头实现
2017-09-20 19:57
731 查看
在组件mounted阶段,给屏幕添加屏幕滚动监听事件:
mounted: function () {
window.addEventListener('scroll', this.menu)
},
屏幕滚动时,指引箭头消失函数:
menu: function () {
this.scroll = document.body.scrollTop
if (this.scroll > 0) {
this.hd = false
} else {
this.hd = true
}
},
html:
<div class="btn-arrow" v-show="this.hd">
<img src="../assets/bottom-arrow.png">
</div>
简单的向下浮动指引的css样式:
.btn-arrow
{
margin:0;
padding: 0;
width: 0.4rem;
height: 0.4rem;
position: fixed;
left: 50%;
margin-left: -0.2rem;
bottom: 2.15rem;
animation:myfirst 1s infinite;
animation-direction:alternate;
-webkit-animation-direction:alternate;
}
.btn-arrow img
{
width:0.45rem;
height: 0.3rem;
}
@keyframes myfirst
{
0% {opacity:1; left: 50%;bottom: 2.15rem;}
/*25% {opacity:0.4; left: 4.6rem;bottom: 2.75rem;}*/
50% {opacity:0.6; left: 50%;bottom: 2.25rem;}
/*75% {opacity:0.8; left: 4.6rem;bottom: 2.9rem;}*/
100% {opacity:0.2; left: 50%;bottom: 2.35rem;}
}
mounted: function () {
window.addEventListener('scroll', this.menu)
},
屏幕滚动时,指引箭头消失函数:
menu: function () {
this.scroll = document.body.scrollTop
if (this.scroll > 0) {
this.hd = false
} else {
this.hd = true
}
},
html:
<div class="btn-arrow" v-show="this.hd">
<img src="../assets/bottom-arrow.png">
</div>
简单的向下浮动指引的css样式:
.btn-arrow
{
margin:0;
padding: 0;
width: 0.4rem;
height: 0.4rem;
position: fixed;
left: 50%;
margin-left: -0.2rem;
bottom: 2.15rem;
animation:myfirst 1s infinite;
animation-direction:alternate;
-webkit-animation-direction:alternate;
}
.btn-arrow img
{
width:0.45rem;
height: 0.3rem;
}
@keyframes myfirst
{
0% {opacity:1; left: 50%;bottom: 2.15rem;}
/*25% {opacity:0.4; left: 4.6rem;bottom: 2.75rem;}*/
50% {opacity:0.6; left: 50%;bottom: 2.25rem;}
/*75% {opacity:0.8; left: 4.6rem;bottom: 2.9rem;}*/
100% {opacity:0.2; left: 50%;bottom: 2.35rem;}
}
相关文章推荐
- Unity 3D追踪效果的实现 目标箭头指引
- Unity 3D追踪效果的实现 目标箭头指引
- vue+jquery+lodash实现滑动时顶部悬浮固定效果
- Unity 3D追踪效果的实现 目标箭头指引
- 利用bootstrap实现悬浮窗口的效果
- 用js枚举实现简易菜单效果
- Android 实现局部图片滑动指引效果
- android ScrollView向上滑动 控件顶部悬浮效果实现
- vue实现点击展开点击收起效果
- Android利用悬浮按钮实现翻页效果
- js实现3d悬浮效果
- css实现横向带箭头步骤流程效果兼容性ie6
- vue2.0使用swiper组件实现轮播效果
- Android view滑动悬浮固定效果实现
- Vue.js实现按钮的动态绑定效果及实现代码
- jQuery实现悬浮在右上角的网页客服效果代码
- canvas实现简易的圆环进度条效果
- java 实现tab页签切换 鼠标悬浮效果
- Vue.js实现表格数据增、删、改、查效果
- 三步实现Android悬浮效果