Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep tethered element in viewport #184

Closed
firasdib opened this issue Jun 11, 2016 · 6 comments
Closed

Keep tethered element in viewport #184

firasdib opened this issue Jun 11, 2016 · 6 comments
Labels

Comments

@firasdib
Copy link

I have a menu that can sometimes grow very tall in my single page application. I would like to limit the height of this menu to that of the available space in the viewport, so that elements don't fall out of reach and the user can scroll inside the menu. How could one achieve something like this?

Whats required (technically) is setting max-height: calc(100vh - translateY) but I don't know how to most efficiently go about doing this.

Thanks!

@yairEO
Copy link

yairEO commented Sep 11, 2016

setting max-height: calc(100vh - translateY) is of course not allowed. can you please create a demo page in jsbin (or somewhere else) with a minimal reconstruction of the scenario?

@firasdib
Copy link
Author

@yairEO No, it was just meant as pesudo-code. What I ended up going was waiting until the element was rendered and grab clientBoundingRect and add a max-height: calc(100vh - rect.top).

I don't have an example right now, but basically, an absolutely positioned element that expands with its children. When it expands beyond the viewport it should be restricted.

@firasdib
Copy link
Author

@yairEO Any progress on this?

@RobbieTheWagner
Copy link
Member

I am not sure I understand the issue here. @firasdib wouldn't setting the max-height work?

@firasdib
Copy link
Author

firasdib commented Mar 6, 2020

@rwwagner90 Sorry for getting back to late. I don't recall myself, but this was for an issue I had on regex101 when building it.

I believe the issue is/was when you tether an element to a specific position and that element then grows taller than the current viewport. I wanted to restrict that element to not be allowed to grow taller than the active viewport.

@RobbieTheWagner
Copy link
Member

Ah, I see. I think that is out of scope at this time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants