Hide "Horizontal" Scrollbar but still able to scroll

I need some help with hiding my horizontal scrollbar and still able to scroll. I have used webkit but does not work in IE and firefox. I have seen alot of help with vertical scrollbar, but does not work with horizontal. Any help?

Update: I have created a JSFiddle to show my problem. I want to hide the horizontal scrollbar and still able to scroll without using

 ::-webkit-scrollbar { 
      display: none; 
   }

http://jsfiddle.net/o1xoh9w8/1/


Here is how you do it, I have tested this in Chrome, IE, Firefox, Opera, Safari(Windows) and Edge

<h1>You can scroll with mouse wheel</h1>

<div id="box">
    <div id="content">
        <p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metus</p>
    </div>
</div>

h1{font-weight:bold;font-size:2em;} /* ignore only for header */
/* *********************** */
div#box{
    height:200px;
    width:300px;     
    overflow:hidden;
    border:1px solid black;
    padding: 10px;
}

div#content{
    height:200px;
    width:326px;
    /*
     * Uncomment to see scrollbar
    width:300px;
    */
    overflow:auto;
}

Here is a JSFiddle: http://jsfiddle.net/JoshMesser/VUSuZ/

Credits go to creator of the JsFiddle

EDIT:

For vertical it is just a matter of changing the height. What you are doing is you are just pushing the scroll bar outside of what user can see, so to them its not there, while in reality it is there hidden behind elements. Here is a JS Fiddle based on my last one. You will see I just forced p to be in single line to get horizontal scrolling and then increased the height to hide the scroll-able bar.

http://jsfiddle.net/VUSuZ/575/

链接地址: http://www.djcxy.com/p/88118.html

上一篇: 隐藏滚动条,但仍然可以在Firefox上滚动

下一篇: 隐藏“水平”滚动条,但仍然可以滚动