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.

malihu custom scrollbar puts <div class='mCSB_draggerRail'></div> in wrong place on electron

See original GitHub issue

malihu custom scrollbar puts html <div class='mCSB_draggerRail'></div> in wrong place on electron. I looked at the versions in my browser and it works just fine. HTML Code it generates looks something like this:

<div class="servers-container mCustomScrollbar _mCS_1" style="overflow: auto;" data-mcs-theme="light-thick">
        <div id="mCSB_1" class="mCustomScrollBox mCS-light-thick mCSB_vertical mCSB_inside" style="max-height: none;"
            tabindex="0">
            <div id="mCSB_1_container" class="mCSB_container" style="position: relative; top: 0px; left: 0px;"
                dir="ltr">
                <div class="servers">
                </div>
            </div>
            <div id="mCSB_1_scrollbar_vertical"
                class="mCSB_scrollTools mCSB_1_scrollbar mCS-light-thick mCSB_scrollTools_vertical"
                style="display: block;">
                <div class="mCSB_draggerContainer">
                    <div id="mCSB_1_dragger_vertical" class="mCSB_dragger"
                        style="position: absolute; min-height: 30px; top: 0px; display: block; height: 372px; max-height: 495px;">
                        <div class="mCSB_dragger_bar" style="line-height: 30px;"></div>
                    </div>
                    <div class="mCSB_draggerRail"></div>
                </div>
            </div>
        </div>
    </div>

But in electron itself, it generates <div class='mCSB_draggerRail'></div> inside <div id="mCSB_1_dragger_vertical" class="mCSB_dragger" style="position: absolute; min-height: 30px; top: 0px; display: block; height: 372px; max-height: 495px;"> which leads to funky behaviour…

Here is what it generates in electron itself:

<div class="servers-container mCustomScrollbar _mCS_1" style="overflow: auto;" data-mcs-theme="light-thick">
        <div id="mCSB_1" class="mCustomScrollBox mCS-light-thick mCSB_vertical mCSB_inside" style="max-height: none;"
            tabindex="0">
            <div id="mCSB_1_container" class="mCSB_container" style="position: relative; top: 0px; left: 0px;"
                dir="ltr">
                <div class="servers">
                
                </div>
            </div>
            <div id="mCSB_1_scrollbar_vertical"
                class="mCSB_scrollTools mCSB_1_scrollbar mCS-light-thick mCSB_scrollTools_vertical"
                style="display: block;">
                <div class="mCSB_draggerContainer">
                    <div id="mCSB_1_dragger_vertical" class="mCSB_dragger"
                        style="position: absolute; min-height: 30px; display: block; height: 77px; max-height: 316px; top: 0px;">
                        <div class="mCSB_dragger_bar" style="line-height: 30px;"></div>
                        <div class="mCSB_draggerRail"></div>
                    </div>
                </div>
            </div>
        </div>
    </div>

Here is code which i use to to “use” this scrollbar:

<script defer src="js/jquery.min.js"></script>
    <script defer src="js/jquery.mCustomScrollbar.concat.min.js"></script>
    <script defer src="renderer.js"></script>
    <script>
        const $ = require('jquery');
        require("jquery-mousewheel")($);
        require("malihu-custom-scrollbar-plugin")($);

        (function($){
        $(window).load(function(){
            $(".horizontalScrollbar").mCustomScrollbar({
                    scrollButtons:{ enable:false },
                    horizontalScroll:true,
                    advanced:{autoExpandHorizontalScroll:true}
                });
            });
        });
    </script>

Also it gives Uncaught ReferenceError: jQuery is not defined error any time i run it. I have no idea what is going on pls help.

P.S. If anything is needed to solve this mystery, i’ll attach it.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

3reactions
Danil-Klimovcommented, May 20, 2020

I had such a problem on one of the projects. As it turned out, the problem was in the version of the jquery. This bug appears in jquery version 3.5.1. With version 3.4.1, everything works fine.

P.S. sorry for my English (Google Translate)

0reactions
AlbeeTheLolicommented, Dec 24, 2020

Switching to another version of jQuery fixed the issue. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

malihu custom scrollbar puts <div class='mCSB_draggerRail ...
malihu custom scrollbar puts <div class='mCSB_draggerRail'></div> in wrong place on electron. I looked at the versions in my browser and it ...
Read more >
Display bug when applying custom-scrollbar-plugin · Issue #237
Hello,. On the video I noticed in the dev tools inspector that the element gets the no_scrollbar class. This means that although the...
Read more >
Scroll to id within element with custom scrollbar(s) – malihu
A simple jquery function to make all links pointing to id attributes within the page, work on content with custom scrollbars.
Read more >
How To Style Scrollbars with CSS - DigitalOcean
In this tutorial, you will learn how to use CSS to customize scrollbars to support modern browsers.
Read more >
Create custom scrollbars using CSS - YouTube
Having a custom scrollbar can help tie the branding of a site together on the page, as well as help it match an...
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