admin管理员组

文章数量:1277901

I am very glad to use this wonderful library - jQuery Nice Select link. But i cant understand why this not support scroll bar especially in google chrome

Chrome :

And Firefox

I can't understand why google chrome doesn't support scroll bar or I should add it somehow?

I am very glad to use this wonderful library - jQuery Nice Select link. But i cant understand why this not support scroll bar especially in google chrome

Chrome :

And Firefox

I can't understand why google chrome doesn't support scroll bar or I should add it somehow?

Share Improve this question edited Jan 28, 2021 at 18:38 dreamcrash 51.6k26 gold badges110 silver badges131 bronze badges asked Jan 25, 2021 at 21:07 Nikola MarinovNikola Marinov 2633 silver badges15 bronze badges 0
Add a ment  | 

3 Answers 3

Reset to default 11

This isn't related to Firefox or Chrome. You may just be looking at the browsers with different viewports.

In any case, you need to add this to your CSS to add a scrollbar:

.list {
  max-height: 100px; // or whatever the height you want
  overflow-y: scroll !important;
}

Source: tested it myself in both Chrome and Firefox.

I know this is a kind of late, but the accepted answer didn't work for me. I had to use the code below to make it work (maybe for a newer version of library):


    .nice-select-dropdown .list {
        height: 100% !important;
        max-height: 100% !important;
        overflow: auto !important;
    }
    
    .nice-select.open .nice-select-dropdown {
        max-height: 240px; /*or whatever height you want*/
        overflow-y: auto;
        overflow-x: hidden;
    }

Try this out...

NOTE: This hides the scrollbar, so some people who prefer scrollbars over gestures may have some trouble accessing your site


/* Hide scrollbar for IE, Edge and Firefox */
.example {
  -ms-overflow-style: none;  /* IE and Edge */
  scrollbar-width: none;  /* Firefox */
}

Credits w3schools

本文标签: javascriptjQuery Nice Select with scroll barStack Overflow