A
A
Andriy Klinov2016-09-22 23:32:57
PHP
Andriy Klinov, 2016-09-22 23:32:57

Units of measurement vh on the tablet (phone). When scrolling, the URL field is hidden. How to make the content not twitch due to the recalculation of the height?

For adaptive layout I use vh units .
On a tablet or phone, when you scroll through content, the URL field is hidden or shown. If we view the page down, it hides. When you press the touchpad and move your finger across the screen, nothing much happens. And at the moment of release and if the URL field is hidden or appeared, the height is recalculated, since the field is not taken into account, but the height of the inner block changes. And for the vh unit, it is the internal content on the screen that matters. If there are three or four such blocks with a block size of 100vh, then looking before the last or last block, it will run up or down. For example, we read the text, scroll through, then we decided to go back up a little and it seemed to us the URL and our text will fly away somewhere, then we will try to catch it, and again the position will change for the same cyclic reason. How to be in this situation. I would solve the whole thing with a script, but there are times when you need to turn your phone or tablet from portrait to landscape. Therefore, a fixed height is not good.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
E
Evgeny Bukharev, 2016-09-10
@evgenybuckharev

As an option, it’s clear that classes A, B, C are given as an example, but I think in general the essence is clear

$type = 'a';
$class_name= strtoupper($type);
if(in_array($class_name,['A', 'B', 'C'])){
return new $class_name;
}

M
Muhammad, 2016-09-10
@muhammad_97

If the class name is equal to the type name, then something like this:

$className = strtoupper($type);

return new $className();

If not, then you can create an array of associations:
$associations = [
    'a' => 'Foo',
    'b' => 'Bar',
    'c' => 'Baz',
];

$className = $associations[$type];

return new $className();

D
dom1n1k, 2016-09-23
@dom1n1k

In such cases, I bind to vmin.
Then, when the screen is rotated, the font size (for example) does not jump.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question