You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@echarts.apache.org by GitBox <gi...@apache.org> on 2018/09/14 09:34:24 UTC

[GitHub] vincentfintend opened a new issue #9078: [Bug] 火狐浏览器下滚动事件无法阻止默认事件

vincentfintend opened a new issue #9078: [Bug] 火狐浏览器下滚动事件无法阻止默认事件
URL: https://github.com/apache/incubator-echarts/issues/9078
 
 
   ### One-line summary [问题简述]
   
   火狐浏览器下使用Mac触控板触发的滚动事件无法阻止默认事件(event.preventDefault不生效)。
   
   当使用鼠标中间滚轮的时候,不会让页面触发滚动,可是使用Mac触控板的话,页面会发生滚动,chrome浏览器下则不会有此问题。
   
   为了实现一些echart不支持的功能,我自己通过原生事件控制echart的dataZoom,然后发现火狐滚动事件有兼容性问题,不清楚echart的实现,但产生的问题是一样的,所以想看看大家有没有什么解决方案,或者实现过类似的事情。
   
   ```js
       const firefox = navigator.userAgent.indexOf('Firefox') != -1;
       firefox ? eCharts.addEventListener('DOMMouseScroll',mouseWheel) : (eCharts.onmousewheel = mouseWheel);
       const mouseWheel = (event) => {
         event = event || window.event;
         if (event.preventDefault) event.preventDefault();
         else event.returnValue = false;
       }
   ```
   ### Version & Environment [版本及环境]
   + ECharts version [ECharts 版本]: 3.8.5
   + Browser version [浏览器类型和版本]:firefox lastest
   + OS Version [操作系统类型和版本]: Mac OS 10.13.6
   
   这个可以说是火狐的问题,鼠标中间的滚轮才可以正确的event.preventDefault(),Mac的触控板则不行,(需要有Mac触控板和普通鼠标滚轮去对比查看效果)。
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@echarts.apache.org
For additional commands, e-mail: dev-help@echarts.apache.org