Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I disable horizontal scrollbar in jScrollPane (JQuery)?

Tags:

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.

like image 256
May Avatar asked Dec 10 '10 01:12

May


People also ask

How do I remove the horizontal scrollbar in Java?

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').

How do I turn off horizontal scrolling in HTML?

To hide the horizontal scrollbar and prevent horizontal scrolling, use overflow-x: hidden: HTML.

Why does horizontal scrollbar appear?

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.


1 Answers

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' }); 
like image 50
Sławek Wala Avatar answered Oct 03 '22 20:10

Sławek Wala