//在mounted()方法里监听mousewheel;
// chrome and ie
window.addEventListener('mousewheel',this.handleScroll,false)firefox
window.addEventListener"DOMMouseScroll",this.handleScroll,false)export default {mounted (){this.imgHeight = document.documentElement.clientHeight || document.body.clientHeight;window.addEventListener('mousewheel',this.handleScroll,false)},data () {return {items:[{'url':require("./assets/pin_01.jpg"),},{'url':require("./assets/pin_02.jpg"),},{'url':require("./assets/pin_03.jpg"),}],isShow:true,nowIndex:0,imgHeight:""}},methods:{goto(index){this.isShow = falsesetTimeout(() => {this.isShow = truethis.nowIndex = index}, 10)},handleScroll (e) {//var direction = e.deltaY>0?'down':'up' 该语句可以用来判断滚轮是向上滑动还是向下if(document.getElementsByTagName("li").length == 1){ //此处决定无论一次滚轮滚动的距离是多少,此事件 //都得等上次滚动结束,才会执行本次this.isShow = falsesetTimeout(() => {this.isShow = true++ this.nowIndexif(this.nowIndex == 3){this.nowIndex = 0}}, 10)}}}}
本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!