0

I am using Laravel php. Head and Footer tags are in my app.blade file.But it doesn't run the preloader in the head tag when it's first opened. It also doesn't load the css file. It comes after 1-2 seconds exactly. It's too fast to take a screenshot, so I uploaded it as a video. I will add the lines of code below along with the video.

https://youtu.be/ihHmQBsSpNs

app.blade.php header codes:

@if(!isset($lang)) @php($lang = 'tr') @endif
@php($slug = Request::segment(1))
<!DOCTYPE html>
<html lang="tr">
<head>  
<title>NovaPia Clinic</title>
<meta charset="UTF-8">
<meta name="description" content="NovaPia Clinic">
<meta name="keywords" content="Dentist, Clinic">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
  
 
    <!-- Stylesheets -->
    <link rel="stylesheet" href="{{ asset('theme/css/style.css')}}"/>
    <link rel="stylesheet" href="{{ asset('theme/css/responsive.css')}}"/>
    <link rel="stylesheet" href="{{ asset('theme/css/animate.css')}}"/>
    

    <link rel="shortcut icon" href="{{ asset('theme/img/favico.png')}}">    


    <link rel="stylesheet" href="{{ asset('theme/icon-fonts/fontawesome-5.0.6/css/fontawesome-all.min.css')}}"/>
    <link rel="stylesheet" href="{{ asset('theme/icon-fonts/flaticon/flaticon.css')}}"/>
    <link rel="stylesheet" href="{{ asset('theme/icon-fonts/flaticon/flaticon.svg')}}"/>
    <link rel="stylesheet" href="{{ asset('theme/icon-fonts/flaticon/flaticon.ttf')}}"/>
    <script src="https://kit.fontawesome.com/40e15e0d0d.js" crossorigin="anonymous"></script>


    <link rel="stylesheet" href="{{ asset('theme/font/stylesheet.css')}}"/>
   

</head> 
<body> 


<div id="preloader">
  <div class="loading-area">
    <div class="logo" style=""><img src="{{ asset('theme/img/nova.png')}}" alt=""></div>
    <span>yükleniyor...</span>
  </div>
  <div class="left-side"></div>
  <div class="right-side"></div>
</div>

<div class="page-overlay">
    <div class="page-transition"></div>
  </div>
<main>


  
  <header class="whitev">
 
    <a href="index.html" class="logo" data-type="ajax-load">
      <img src="{{ asset('img/nova.svg')}}" alt="">
    </a>

    <div class="nav-icon">
      <span></span>
      <span></span>
      <span></span>
      </div>
  </header>```
  


canswartz
  • 3
  • 6

1 Answers1

0

You must add display:none in the body, and add a setTimeout to change the display value to block after 5 seconds for example, like that :

<body style="display:none" id="body_id">

<script>setTimeout(() => { document.getElementById('body_id').style.display = 'block'; }, "5000");</script>
oussama zaqouri
  • 174
  • 1
  • 9
  • 1
    Don't use a meaningless fixed time. You can always detect whether the contents are loaded or not using JavaScript. – Raptor Jun 28 '22 at 08:56
  • @Raptor yes you right – oussama zaqouri Jun 28 '22 at 08:59
  • That solve but i have i small problem. [I add your code but it looks like this](https://imgur.com/a/YC2v5uW)
    [normally it should be like this](https://imgur.com/a/zphxh3s). Below is the line of code I added. `
    – canswartz Jun 28 '22 at 09:02
  • @canswartz the picture link is wrong – oussama zaqouri Jun 28 '22 at 09:05