[question] Dropdown: adjust dropdown menu height and content overflow
See original GitHub issueI’m working to accommodate mobile devices in my application, and we have various large dropdown lists to render. From pretty much any point on the page, our dropdown menus exceed the page size. Unfortunately, this isn’t a scrollable page, but more of the mobile-app style with full screen content.
Is there a good way to apply some styling to control menu size and overflow? I imagine I could just apply some more nested css selectors (although I’ve been going strong with flat classes thus far):
.my-component .dropdown-menu {
max-height: $really-tiny-mobile-menu-height;
overflow-y: scroll;
@media (min-width: $not-tiny-mobile){
// media query stuff
}
}
But beyond that, any ideas for calculating height based on the position of the element on the page and the size of the page? Maybe just use a mounted
hook to grab an element position, and yada-yada some size calc logic? Seems a bit manual. Thoughts?
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (7 by maintainers)
Top Results From Across the Web
How to Set Height for the Drop Down of Select box
In Case of setting size (height/width) and fitting the selection list in the pop up then try the following in VFPage- Salesforce:
Read more >Overflowing content - Learn web development | MDN
The first example is a box that has been restricted by setting a height . Then we add content that exceeds the allocated...
Read more >Dropdown Height of Options | OutSystems
I am trying to find a way to limit the height of drop down by half. Actually a similar question came up and...
Read more >What is the recommended height of a dropdown menu that ...
In your case make the dropdown occupy as much as you need (full-height with some margin below) so more options are visible without...
Read more >Solution For Very Long Dropdown Menus - CSS-Tricks
jQuery Makes it Tick · Set a maximum height to the dropdowns · On hover, reveal the submenu · Calculate a speed multiplier...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m finding some interesting data by using
element.getBoundingClientRect()
. Among the object props returned are the x, y, w, & h of the element relative to the viewport.No objections.
I’ll post the CSS here once I find it