noeldelgado / gemini-scrollbar

:first_quarter_moon: Custom overlay-scrollbars with native scrolling mechanism for web applications

Home Page:https://noeldelgado.github.io/gemini-scrollbar/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How I can assgine it to multiple divs.

Dhaval8087 opened this issue · comments

I have a multiple divs which classname is same and I want to apply scrollbar to all div is it possible because if I will use
var myScrollbar = new GeminiScrollbar({
element: document.querySelector('.my-scrollbar')
}).create();

it will take very first element how I can assign scroll to multiple element

Hi, you need to create an instance per every element.
The approach is up to you, the following is just an example:

var scrollbarElements = [].slice.call(document.querySelectorAll('.my-scrollbar'), 0);

scrollbarElements.forEach(function(element) {
    new GeminiScrollbar({
        element: element
    }).create();
});

@noeldelgado :Thanks I will check it and close it