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

translateY(calc(env(safe-area-inset-top) + 12px)) scale(0.954023); in rootId it does not work correctly #1

Closed
rivaslive opened this issue Oct 1, 2020 · 3 comments

Comments

@rivaslive
Copy link

rivaslive commented Oct 1, 2020

THANK'S!

first of all, give thanks for the great work

PROBLEM:

when I select rootId to do the iOS effect, the div generates excessive top margin, and it doesn't do the effect like this in the demo , I would like to know what I am doing wrong ?, embed my Tag <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, viewport-fit=cover"/>,
I am using Nextjs, and I try to use env () in the official site of next and it seems to have a similar behavior, maybe something specific to the DOMVirtual, maybe they should look for an alternative to that effect ...

image

env() CSS in Nextjs Page:

image

@Temzasse
Copy link
Owner

Thanks for reporting this! 🙏

The problem here is that the iOS effect currently assumes that the root element height is 100% of the viewport height but this might not be true in certain cases like your Nextjs example. If the root element is much higher the scale calculation will produce incorrect looking result.

One way to fix this issue is to make sure the root element height is 100% the viewport height by applying these styles to the root:

height: 100vh;
overflow: auto;

I will investigate if I could make the scale calculations for the iOS effect more robust somehow 🤔 🕵️

@Temzasse
Copy link
Owner

The way a webpage works by default is that the whole body of the page is scrollable which is not compatible with the iOS effect since there is no way to do the effect if you have scrolled down from the top of the page because the effect relies on transforming the root element. So in order to make the effect work properly you have to set the root element height to be exactly the same as the viewport height.

@rivaslive
Copy link
Author

excellent, set my container height as you said and it works as desired

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

No branches or pull requests

2 participants