Closed sea35 closed 6 years ago
嵌套使用,父元素为上下滑动,子元素为左右滑动,这时有个需求是焦点在子元素时向上滑或向下滑,希望是触发父元素的上下滑动,但是动不了,因为这时的焦点在子元素上,这个需求需要如何处理
用call方法就可以
// outer 外层 // inter 内层 inter.on('scrollStart', () => { this.tempX = this.x // 找个变量记录一下 }) inter.on('scroll', e => { if (this.tempX === this.x) { // x的值没改变,表明是上下滑动 this.call(outer, e) } })
嵌套使用,父元素为上下滑动,子元素为左右滑动,这时有个需求是焦点在子元素时向上滑或向下滑,希望是触发父元素的上下滑动,但是动不了,因为这时的焦点在子元素上,这个需求需要如何处理