How to accurate the canvas height with mobile keyboard shown?
Suppose I want the red Div to remain centered regardless of whether the keyboard is displayed. I've noticed that the canvas height remains fixed even when I use 100%, 100vh, 100dvh, 100lvh, or 100svh. Here's the pen I'm working on:
https://codepen.io/hackett-lai/pen/eYbvbwM
What's the best solution for this scenario?
1 Reply
I'm still stuck with this problem... I come across this stackoverflow post:
https://stackoverflow.com/questions/23023549/get-viewport-height-when-soft-keyboard-is-on
I attempted to adjust the container height through JavaScript. It appears to have some effect, but after scrolling to the end, it inexplicably allows for additional scrolling, as seen in the video.
I've uploaded my code to a new CodePen for further insights:
https://codepen.io/hackett-lai/pen/NWVPLqw
Stack Overflow
Get viewport height when soft keyboard is on
I want to get the exact viewport size when the soft keyboard is up. I am currently using the following code on the header in order for the site to be responsive:
<meta name="viewport"