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

Scrollbar not updating with Select2 autocomplete #599

Open saravanaams opened 6 years ago

saravanaams commented 6 years ago

Hi, I'm using the malihu scrollbar in select2 autocomplete. It's working.But when i type something in autosomplete the scrollbar changes to its default style. I'm using Aurelia JS. Could you please help to fix this. import { customAttribute, inject } from 'aurelia-framework'; import $2 from 'jquery2'; import $3 from 'jquery3';

@customAttribute('select2-searchbox') @inject(Element) export class Select2SearchboxCustomAttribute { constructor(element) { this.element = element; }

attached() {
    $2(this.element).select2({
            minimumInputLength: 0,
            placeholder: function() {
                $2(this).data('placeholder');
            }
        })
        .on('change', (e) => {
            if (!e.originalEvent) {
                this.element.dispatchEvent(
                    new CustomEvent('change', { bubbles: true })
                );
            }
        }).on('select2:open', function(e) {
            $3('.select2-results__options').mCustomScrollbar('destroy');
            setTimeout(function() {
                $3('.select2-results__options').mCustomScrollbar();
            }, 0);
        });
}

detached() {
    $2(this.element).select2('destroy');
}

}

viktorkyssa commented 5 years ago

I have the same issue but without any frameworks

amanpoptin commented 4 years ago

I am having the same issue, already spent enough time searching for solution, I found another library nicescroll and it is working fine with select 2.