在百度上注册公司网站要多少钱,wordpress 不同分类目录调用不同模板的方法,WordPress会员卡插件,wordpress链接视频分享一个前端可视化常用的卡片列表滚动组件#xff0c;常用于可视化项目左右两侧的卡片列表的滚动。效果如下图所示#xff1a; 组件描述
当鼠标移入滚动区域时#xff0c;滚动行为停止当鼠标再次离开时#xff0c;滚动继续
源码展示
templatediv ref…分享一个前端可视化常用的卡片列表滚动组件常用于可视化项目左右两侧的卡片列表的滚动。效果如下图所示 组件描述
当鼠标移入滚动区域时滚动行为停止当鼠标再次离开时滚动继续
源码展示
templatediv refmoocBox classcustom-scroll-content mouseoutmouseOut mouseovermouseOverslot/slot/div
/template
script
export default {name: CustomScroll,data() {return {speed: 50,myScroll: null};},created() {},mounted() {this.myScroll setInterval(() {this.scrollUp();}, this.speed);},destroyed() {clearInterval(this.myScroll);// removeEventListener(scroll, this.myScroll);},beforeDestoryed() {clearInterval(this.myScroll);this.myScroll null},methods: {/*** description: 滚动* return void 滚动*/scrollUp() {this.$refs.moocBox.scrollTop 1;// 判断滚动条是否到底if (this.$refs.moocBox.scrollTop this.$refs.moocBox.clientHeight this.$refs.moocBox.scrollHeight) {this.$refs.moocBox.scrollTop 0;}},/*** description: 鼠标滑过暂停滚动* return void 清除定时器实现暂停*/mouseOver() {clearInterval(this.myScroll);},/*** description: 鼠标移开重新滚动* return void 设定定时器实现滚动*/mouseOut() {this.myScroll setInterval(() {this.scrollUp();}, this.speed);},}
};
/script
style
.custom-scroll-content {height: 100%;overflow: auto;
}
/style
使用指南
templatediv classhomediv classcontainer__div_height-500CustomScrolldiv classitem__div_height-100 v-fori in 10 :keyi{{ i1 }}/div/CustomScroll/div/div
/template
import CustomScroll from ../components/customScroll.vue;export default {name: Home,components: {CustomScroll,},
}
/script
style
.home {height: 100%;width: 100%;display: flex;align-items: center;justify-content: center;
}
.container__div_height-500 {height: 500px;width: 400px;
}
.item__div_height-100 {height: 100px;width: 100%;background-color: pink;margin-bottom: 12px;cursor: pointer;
}
.item__div_height-100:last-child {margin-bottom: 0;
}
::-webkit-scrollbar {width: 0!important;
}
/style属性说明
属性属性值类型speed设置滚动速度默认50Number