malihu / malihu-custom-scrollbar-plugin

Highly customizable custom scrollbar jQuery plugin, featuring vertical/horizontal scrollbars, scrolling momentum, mouse-wheel, keyboard and touch support etc.
http://manos.malihu.gr/jquery-custom-content-scroller
MIT License
4.11k stars 1.51k forks source link

Chrome to v.46 #361

Open sentbyravens opened 8 years ago

sentbyravens commented 8 years ago

Hi, malihu! We are using mCustomScrollBar v. 3.1.1 for smooth scroll to anchors from another pages. But our code just stop works after we update Chrome to 46.0.2490.71.

But if we will use version 3.0.9, anchors start work again. Can you solve that issue, please?

Our code:

$(window).load(function () {
                var hash = $(location).attr('href').split('#')[1];
                $('html, body').scrollTop(0);
                if ( typeof hash != 'undefined'){
                    var $_elem = $('#' + hash);
                    var offset = $_elem.offset().top - 30;
                    $(".right_content_container").mCustomScrollbar("scrollTo", offset);
                }
            });
malihu commented 8 years ago

Hello,

I'm not sure about this... Your code seems correct and I've just tested it on latest Chrome (46.0.2490.71) with plugin version 3.1.1 and it does work.

Do you get any console errors in Chrome dev tools? Can you send me a link?

sentbyravens commented 8 years ago

Sure! We are just created 2 pages with a different version of plugin (mcustomscrollbar with version 3.0.9 and mcustomscrollbar2 with version 3.1.1) special for you. There is a links encoded in base64 (UTF-8)(https://www.base64decode.org/): For 3.0.9 aHR0cDovL3RlYW10cmFucy5iaXovbWN1c3RvbXNjcm9sbGJhci8= For 3.1.1 aHR0cDovL3RlYW10cmFucy5iaXovbWN1c3RvbXNjcm9sbGJhcjIv

For navigation please use links like on a screenshot: screenshot_52

malihu commented 8 years ago

Firstly, thanks for creating the pages so I could see what's really going on :)

So here's the deal...

The scrollbar on 3.1.1 page didn't work correctly at all (not just the scroll-to anchors). This is because you have the following CSS rule in teamtrans.css on line 794:

.mCSB_container, .mCustomScrollBox {
    overflow: visible !important;
}

You need to remove the .mCustomScrollBox selector from this rule:

.mCSB_container {
    overflow: visible !important;
}

Doing this will immediately fix everything (scrolling, anchors etc.).

.mCustomScrollBox element needs to be overflow:hidden, otherwise in version 3.1.x the scrollbar won't work. That is because I did update the auto-update function to be much more efficient.

By removing the selector, you'll probably need to adjust some other CSS rules to make the right red border visible again. I'm guessing removing padding-right: 15px; from .right_content_container and margin-right: -15px; from .row will do the trick.

Also, you could use the theme:"minimal-dark" in order to make the scrollbar visible on the white/light-colored background (I'm not sure you want this).

sentbyravens commented 8 years ago

Thank you very much for answer! We will fix it today! :)