I hope I am asking it correctly, I am creating a website and saved an HTML and CSS files for my navbar and footer.
I am trying to load those files from different pages on the site.
My index page isn't loading anything, it has the navbar and footer inside the index.html and index-style.css.
However, when I am using the load function on the other pages there is some kind of delay and you can see on the top left side of the page some kind of a "jump" where you see the HTML for half a second then the navbar and footer are loaded.
This is how my code looks like:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link rel="icon" type="image/png" href="../images/logo/soup.png">
<title>Souplease - Gallery</title>
<link rel="stylesheet" type="text/css" href="../css/gallery-style.css">
<link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap" rel="stylesheet">
<!--Font Awesome-->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css">
<script src="https://kit.fontawesome.com/44f557ccce.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
</head>
</head>
<body>
<!-- Navigation Bar -->
<nav class="load-navbar"></nav>
<!-- more code here -->
<!-- Footer -->
<footer id="load-footer"></footer>
<script type="text/javascript">
$(document).ready(function() {
$(".load-navbar").load("navbar.html");
$("#load-footer").load("footer.html");
});
</script>
</body>
</html>
You can also check this short video to understand the problem better. Pay attention to the top left side of the screen
[jquery load](https://api.jquery.com/load/)2) debug by watching the network tab in the browser to see what it's doing. 3) if you don't want FOUC (the flash) then don't use jquery doc.ready