Can you guys please let me know what is the best way to disable the horiontal scroll bar?
I have div with width: 100%
and height :280px
. When we have long continuous text (without any spaces), we are getting a horizontal scrollbar displayed.
Btw I am using jscrollPane.
Any suggestions would be appreciated.
Just set the display to "none" using the CSS class for the horizontal bar. At the bottom of your jScrollPlane (after you've initialized it), add in: $('. jspHorizontalBar').
To hide the horizontal scrollbar and prevent horizontal scrolling, use overflow-x: hidden: HTML.
Web browsers do not take into account the width of the scrollbar on the side of a page when computing width values, so since we have a page that is longer than a single viewport, part of our page is being rendered behind the vertical scroll bar, causing the browser to display a horizontal scroll bar.
What I have found in jScrollPane - settings object documentation:
contentWidth - int (default undefined)
The width of the content of the scroll pane. The default value of undefined will allow jScrollPane to calculate the width of it's content. However, in some cases you will want to disable this (e.g. to prevent horizontal scrolling or where the calculation of the size of the content doesn't return reliable results)
So to get rid of horizontal bars, just set content width lower than the container width.
Example:
$('#element').jScrollPane({ contentWidth: '0px' });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With