Show progress bar when page is loading.
Nanobar is a very lightweight progress bar which generates a highly customizable top bar.
Download and extract the latest release. Unzip the package and copy the nanobar.min.js file your project or website folder, for example /assets/js/nanobar.min.js.
Edit _layouts/default.html, insert script tag and set src to the path of the minimized version nonabar.
<script src="/assets/js/nanobar.min.js"></script>
Edit _layouts/default.html, add nanobar below the navigation bar.
...
<body>
<nav
class="navbar navbar-expand-lg bg-dark fixed-top navbar-dark navbar-custom"
>
...
</nav>
<div class="nanobar" id="top-progress-bar" style="position: fixed;">
<div class="bar"></div>
</div>
...
</body>
Add the following css for nanobar into /assets/css/main.scss.
.nanobar .bar {
margin-top: 56px;
background: #1cc927;
}
Create nanobar with javascript and assign it to div with classname nanobar. Notice, the progress is dummy. It is fixed with three steps.
<!-- add dummy progress bar -->
<script>
var options = {
classname: "nanobar",
id: "top-progress-bar",
};
var nanobar = new Nanobar(options);
nanobar.go(30);
nanobar.go(76);
nanobar.go(100);
</script>
Access any page, there is a green top bar below the navigation bar.
