Answer the question
In order to leave comments, you need to log in
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
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;
}
If the class name is equal to the type name, then something like this:
$className = strtoupper($type);
return new $className();
$associations = [
'a' => 'Foo',
'b' => 'Bar',
'c' => 'Baz',
];
$className = $associations[$type];
return new $className();
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question