noeldelgado / gemini-scrollbar

:first_quarter_moon: Custom overlay-scrollbars with native scrolling mechanism for web applications
https://noeldelgado.github.io/gemini-scrollbar/
MIT License
428 stars 63 forks source link

How I can assgine it to multiple divs. #15

Closed Dhaval8087 closed 8 years ago

Dhaval8087 commented 8 years ago

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

noeldelgado commented 8 years ago

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();
});
Dhaval8087 commented 8 years ago

@noeldelgado :Thanks I will check it and close it