Z
Z
zeaovede2021-06-29 17:19:58
Yii
zeaovede, 2021-06-29 17:19:58

How to get rid of jerky loading in yii2?

Inline styles are loaded from the home_two.php file, after which styles from a separate file are loaded. How to get rid of jerky loading in yii2? Now loading looks like this: html + inline styles from home_two.php + the same styles from a separate main.css file. How to make one download i.e. html+separate file with styles and remove inline styles? Because I tried to comment them out/delete, but then there is a bare loading of html + an attempt to refer to inline styles + loading a separate file with styles. Who had experience of interacting with a similar problem, beacon in which direction to move

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
vitaly_74, 2021-06-29
@zeaovede

Perhaps you should use Assets? https://yiiframework.com.ua/ru/doc/guide/2/structu...

M
MikUrrey, 2021-06-29
@MikUrrey

An attempt to turn to inline styles - what kind of animal is this?) If there are no inline styles, then there are no attempts there either, or this is some kind of confusion in terminology.
I would make an inline style, the minimum required to display some kind of animated loader on top of the loading page (which I would place with the very first tag after ) and remove the page scroll. And at the end of the CSS file, I would add rules that hide the loader and return the scrollbar. A kind of "curtain" that will hide the "barn" and rise when the "palace" appears

<head>
<!--  ...  -->
<style>
.loader {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url(здесь красивый сплэш);
  opacity: 1;
  will-change: opacity;
  transition: opacity 1s;
}
html, body {
  overflow: hidden;
}
</style>
<link type="style/css" rel="style.css" />
</head>
<body>
<div class="loader"></div>
<!--  ...  -->
</body>

style.css:
/*
...
...
...
*/
.loader {
  opacity: 0;
}
html, body {
  overflow: auto;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question