jquery-nice-select icon indicating copy to clipboard operation
jquery-nice-select copied to clipboard

Overflow issue for fields that have a large amount of options/choices

Open dave4jr opened this issue 9 years ago • 6 comments

I was having an issue where if I had a field with large amount of choices (i.e. - State or Country Field), there was no scrollbar and the list overflowed outside of the div. I fixed this by setting:

.nice-select .list { max-height: 300px; overflow: scroll; }

dave4jr avatar Oct 08 '16 22:10 dave4jr

+1

Sinequanonh avatar Dec 14 '16 21:12 Sinequanonh

Just, what I needed. I've add a little fix:

.nice-select .list { max-height: 300px; overflow-y: scroll; }

Surbma avatar May 21 '17 08:05 Surbma

Errrm, this didn't work until I added .open to .nice-select

.nice-select.open .list { max-height: 300px; overflow-y: scroll; }

kenshinman avatar Jul 04 '17 15:07 kenshinman

Problem is, elements hidden atthe bottom of the list won't show up, and you need to take care of it in the click handler, to get the selected element into focus.

I solved it like this:

$(".nice-select.main").on("click", function() { setTimeout(function() { $(this).find(".list li.selected")[0].scrollIntoView(); }.bind(this), 100); });

yaniv-mobilebrain avatar Aug 10 '17 08:08 yaniv-mobilebrain

Not working for me

basheer-atx avatar Mar 09 '18 17:03 basheer-atx

Apparently, combining @Surbma and @yaniv-mobilebrain' s solutions, fixed the problem of content overflowing inside a div and maintains a height of 300px and also the contents inside ul.list become scrollable Screenshot from 2024-01-25 09-00-46

harontaiko avatar Jan 25 '24 06:01 harontaiko