How to use Jquery Custom Scrollbar on elements with display: none

2

It does not mount the scroll bar on elements that are with "display: none". Does anyone know how to solve it?

Here the scrollbar plugin

    
asked by anonymous 28.02.2014 / 19:07

2 answers

1

Put a handler on your elements for when they are displayed:

$('.elemento').each(function() {
    if (!$(this).is(':visible')) {
        return;
    }
    $(this).mCustomScrollbar({
        scrollButtons: {
            enable: true
        }
    });
});
    
28.02.2014 / 19:20
0

The element can only be used by jQuery when the element is displayed: block or something similar, You could try to apply the custom Scrollbar as soon as the element is displayed.

Ask the question anyway: What action did you take to apply the custom scrollbar? "is in the click event of some element being displayed," then call the custom scrollbar assembly at the event.

    
28.02.2014 / 19:20