将 overflow-scrolling 设置为触摸 iPad 会覆盖所有为 webkit-scrollbar 设置的自定义 css,是否有任何解决方法?

Setting overflow-scrolling to touch on iPad overrides all custom css set for webkit-scrollbar, is there any fix for this?

如果我为 div 设置以下 css:

-webkit-overflow-scrolling: touch;

我用于隐藏滚动条的自定义 css 被覆盖,默认滚动条出现在 iPad。

这是我用来隐藏滚动条的css:

  ::-webkit-scrollbar {
    width: 12px;
    opacity:0;
  }
  ::-webkit-scrollbar-track {
      opacity:0;
  }
  ::-webkit-scrollbar-thumb {
      opacity:0;
  }

如果您知道在溢出滚动设置为触摸时覆盖默认滚动条的任何解决方案,我将不胜感激。

谢谢!

你应该看看一些 jQuery custom content scroller 插件,尤其是像 contentTouchScroll: integer 这样的选项,它可能会帮助你检测触摸屏然后玩这个。

否则,您应该(像建议的那样 here) use Modernizr

if (Modernizr.touch){
   // bind to touchstart, touchmove, etc and watch `event.streamId`
}

为什么不将它们都与

一起使用
if (Modernizr.touch){
   $(".content").mCustomScrollbar({
       contentTouchScroll: false
   });
}

祝你好运'