Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/468.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用溢出时隐藏滚动条:滚动;但保持滚动能力_Javascript_Jquery_Css_Overflow - Fatal编程技术网

Javascript 使用溢出时隐藏滚动条:滚动;但保持滚动能力

Javascript 使用溢出时隐藏滚动条:滚动;但保持滚动能力,javascript,jquery,css,overflow,Javascript,Jquery,Css,Overflow,可能重复: 我为一个web应用程序制作了一个UI。它是一个侧栏,需要让用户在没有滚动条的情况下滚动浏览。内容物高500像素,但容器高300像素 我已将容器设置为有溢出:滚动,但随后我得到了滚动条(我预期的)。我知道我可以使用overflow:hidden禁用滚动条,但这也会禁用滚动 有没有办法允许它滚动,但禁用滚动条?请参阅 或者使用jQuery捕捉鼠标滚轮和鼠标滚轮插件:请参见 或者使用jQuery捕捉鼠标滚轮和mousewheel插件: // get the width of the te

可能重复:

我为一个web应用程序制作了一个UI。它是一个侧栏,需要让用户在没有滚动条的情况下滚动浏览。内容物高500像素,但容器高300像素

我已将容器设置为有
溢出:滚动
,但随后我得到了滚动条(我预期的)。我知道我可以使用
overflow:hidden
禁用滚动条,但这也会禁用滚动

有没有办法允许它滚动,但禁用滚动条?

请参阅

或者使用jQuery捕捉鼠标滚轮和鼠标滚轮插件:

请参见

或者使用jQuery捕捉鼠标滚轮和mousewheel插件:

// get the width of the textarea minus scrollbar
var textareaWidth = document.getElementById("textarea").scrollWidth;

// width of our wrapper equals width of the inner part of the textarea
document.getElementById("wrapper").style.width = textareaWidth + "px";