I am trying to use the JQuery custom scroll-bar script discussed here on my jekyll powered Github site. I would like to it use for scrolling code blocks in each page such that for each code block there is a horizontal or vertical (or both) scroll bar if there is an overflow. However, the heights of different code blocks vary and so the plugin has to work with CSS property max-height: nPx
rather than height: nPx
.
The problem is that if I define only max-height: nPx
without the height: nPx
property (which I dont want since I want height to be auto/to vary with content), then the entire code block collapses such that the scrollbars disappear altogether, along with the content.
Here is a minimal reproducible example on Jsfiddle with only the max-height
defined. Setting height: nPx
makes the content and scrollbars work okay: except this is not an option: in my case, height
must be auto.
I have looked at the author's example on using the plugin with max-height
in the provided archive but in the max-height.html
example, mCustomScrollbar
is not called manually as I am doing in my example so I cant just "copy-paste" from the example.
What could I be missing here?