I want to display website of mobile without sudden changes of position when user change direction of scrolling.
The problem occurs when user of mobile device scroll down and up. Then height of view is changed because of browser shows menu. In consequence user instant see other fragment of website that before.
I present sample of code:
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale = 1.0, maximum-scale = 1.0, user-scalable=no">
<style>
p { padding-top: 6vh; }
</style>
</head>
<body>
<!-- some paragraphs -->
<section>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi egestas ornare risus a efficitur. Nulla laoreet sagittis magna sed facilisis.</p>
<p> Aliquam nec enim porta, condimentum nibh et, posuere sapien. Sed id consectetur erat. Cras malesuada turpis ut iaculis feugiat. </p>
...
<p>Donec ac enim hendrerit, placerat leo aliquam, mollis mauris. Proin vitae purus ligula. Ut lectus arcu, ullamcorper et feugiat ut, feugiat ut orci. </p>
<p>Phasellus augue eros, vestibulum pharetra tempus id, tristique ullamcorper urna. Donec sed augue commodo, placerat quam a, scelerisque dui.</p>
</section>
</body>
</html>
- All code is available *
On fiddle:
Version with meta tag to test on mobile browser:
And list of solutions that failed:
viewport-units-buggyfill
- after cloning repository and start examplevh
changes when bottom menu shows.heigth: -webkit-calc(100% - 0px);
- it works on mobile quite good, but in computer work completely differ than vhjQuery - second source
- in this method I have to locate any element with heigth that use vh unit
Sources:
Is there any method to apply great vh
on mobile without problems like this?