M
M
magary42016-10-25 11:24:40
css
magary4, 2016-10-25 11:24:40

Large css, page blinking when loaded in firefox?

Css file - one 1M in size, in chrome everything is ok, when you open it in firefox - first there is a markup without styles and then there is a transformation
03bced8cb9224a4399bc414eb0020d34.png628ac88e68f54e13bc3bae93563bf4d8.png
how to win?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey Goryachev, 2016-10-25
@magary4

I had such a problem, it was decided by the preloader.
Add to head

<style>
body, html { opacity: 0; }
</style>

and hang a preloader that would overlap back.
<!-- preloader -->
    <style type="text/css">
        .preloader_bg { position: fixed; background: rgba(15,15,15,1); width: 100%; height: 100%; top: 0; left: 0; z-index: 200; }
        .preloader_content { position: fixed; left: 50%; top: 50%; transform: translate(-50%,-50%); z-index: 201; font-size: 14px; }
        .preloader_content span { display: block; margin: auto; text-align: center; text-transform: uppercase; color: rgba(225,225,225,1);}
    </style>
    <script type="text/javascript">
    $(function(){
        $('.preloader_bg, .preloader_content').fadeIn(0);
        $(window).load(function(){
            $('body,html').css({ opacity: 1 }); // снимаем прозрачность
            $('.preloader_bg').delay(250).fadeOut(1500);
            $('.preloader_content').delay(250).fadeOut(750);
        });
    });
    </script>
    <div class="preloader_bg"></div>
    <div class="preloader_content">
        <span>Идет загрузка...<br>Подождите...</span>
    </div>
    <noscript>
        <style>
            html, body { opacity: 1 !important; }
            .preloader_bg, .preloader_content { display: none !important; }
        </style>
    </noscript>
    <!-- /preloader -->

D
dom1n1k, 2016-10-25
@dom1n1k

Highlight the critical css code and load it first. It is even possible to insert it inline into html.
And for preloaders you want to kill. Let it blink better.

F
fraky, 2016-10-25
@fraky

If you see correctly - 928Kb.
I would definitely cut it into pieces and first load what is responsible for the first screen, the rest - as needed

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question