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";