question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

mCS_no_scrollbar always added to DOM

See original GitHub issue

Javascript:

$(window).load( function() {
        SetImageSizes();
        $(".student-header").css("height", "49px");
        $(".student-header").css("overflow-y", "hidden");

        $.getScript("/Scripts/Libraries/jquery.mCustomScrollbar.js", function () {
             $('.student-header').mCustomScrollbar({
                    theme: "dark-2"
                  });
           });
    });

DOM output:

<div class="header student-header mCustomScrollbar _mCS_1 mCS_no_scrollbar" style="height: 49px; overflow-y: hidden;">
<div id="mCSB_1" class="mCustomScrollBox mCS-dark-2 mCSB_vertical mCSB_inside" tabindex="0">
<div id="mCSB_1_container" class="mCSB_container mCS_y_hidden mCS_no_scrollbar_y" style="position: relative; top: 0px; left: 0px;" dir="ltr">
<div id="mCSB_1_scrollbar_vertical" class="mCSB_scrollTools mCSB_1_scrollbar mCS-dark-2 mCSB_scrollTools_vertical" style="display: none;width: 8px;height: 50px;">
<div class="mCSB_draggerContainer">
<div id="mCSB_1_dragger_vertical" class="mCSB_dragger" style="position: absolute; min-height: 0px; height: 0px; top: 0px;" oncontextmenu="return false;">
<div class="mCSB_dragger_bar" style="line-height: 0px;"
></div>
</div>
<div class="mCSB_draggerRail" style="width: 8px; height: 9px;">
</div>
</div>
</div>
</div>
</div>

I, of course, would like the scrollbar to be appearing and cannot figure out why mCSB_no_scrollbar is being added to the DOM.

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
malihucommented, Feb 18, 2015

Plugin CSS is essential for the script to work as it contains the basic styling of all elements, especially the main content wrapper (.mCustomScrollBox). Without this, the script cannot calculate correctly content/scrollbar dimensions, so it wrongly assumes that content does not need scrolling (.mCSB_no_scrollbar).

The script itself adds very few inline styles. It mostly toggles classes and all the classes rules are defined in jquery.mCustomScrollbar.css. This was done on purpose as it gives the developer the freedom to change many core things via CSS without modifying the javascript (it’s basically the reason you can design any kind of scrollbar).

0reactions
malihucommented, Dec 15, 2015

@rafaqf Thanks for the feedback! I’ll try and see if/how to add such warning on the next version.

Read more comments on GitHub >

github_iconTop Results From Across the Web

jQuery custom content scroller – malihu | web design
Update scrollbar(s) automatically on content, element or viewport resize. The value should be true (default) for fluid layouts/elements, adding/ ...
Read more >
malihu custom scrollbar puts <div class='mCSB_draggerRail ...
I solved this issue. Jinixx uploaded a fix for this issue: malihu-custom-scrollbar-plugin 3.1.7. This issue caused by new jQuery 3.5.x that ...
Read more >
jQuery Custom Scrollbar Plugin - malihu
malihu is a jQuery plugin that allows you to beautify your content scrollbar with CSS and jQuery UI.
Read more >
scrollbar-gutter - CSS: Cascading Style Sheets - MDN Web Docs
Classic scrollbars are always placed in a gutter, consuming space when ... Add symmetric spacing to both sides of the box so the...
Read more >
Scrollbar Reflowing | CSS-Tricks
If you can't do that, or you're setting the width on another element, add overflow-x: hidden or overflow: hidden to the surrounding element...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found