Is there a way to incorporate a preload page in Jekyll?

I recently stumbled upon this unique preload page style on Codepen and I must admit, my knowledge of JS is quite limited.

body{
    display: flex;
    justify-content: center;
    align-items: center;
    height: 870px;
    background-color:#000;
    position: relative
}

p{
    font-weight: bold;
    font-size: 30px;
    color:#00ff00;
    display: inline
}

div{
    display: flex;
    justify-content: center;
    align-items: center;
    width:400px;
    height:400px
}

div > span{
    background-color:transparent;
    height:190px;
    width:190px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    border:20px solid transparent;
    border-bottom:20px solid red;
    border-top:20px solid red;
    animation: rotateleft 1.25s infinite ease-in-out;
    position: absolute;
}

div > span ~ span {
    background-color:transparent;
    width:150px;
    height:150px;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    border:20px solid transparent;
    border-left:20px solid red;
    border-right:20px solid red;
    animation: rotateright 1.25s infinite ease-in-out;
    position: absolute;
}

section{
    position: absolute;
    width:;
    overflow: hidden;
    animation: words 2.5s infinite ease-in-out
}

@keyframes words{
    from {
        width:0
    }
    
    to{
        width:130px
    }
    
}

@keyframes rotateleft{
    from{
        transform: rotate(0)
    }
    
    to{
        transform: rotate(-360deg)
    }
}

@keyframes rotateright{
    from{
        transform: rotate(0)
    }
    
    to{
        transform: rotate(360deg)
    }
}
<section><p>Loading...</p></section>
        <div>
            <span></span>
            <span></span>
        </div>

This fascinating design has inspired me to integrate it into my website's loading screen. However, my question is: How can I implement this using Jekyll? Can I specify a location in the code where this should appear before the index loads? Do I need to incorporate a JavaScript function, or can this be achieved solely with HTML and CSS like in the example provided?

Answer №1

Utilizing Jquery enables you to achieve the following:

$(window).load(function(){
   $('#overlay').fadeOut();
});

Within the #overlay division, insert the loading bar of your choice.

Below is a code snippet demonstrating how this can be implemented:

$(window).load(function(){
   $('#overlay').fadeOut(2000);
});
#overlay {
    position: fixed; /* Positioned on top of the page content */
    width: 100%; /* Covers the entire width of the page */
    height: 100%; /* Occupies the full height of the page */
    top: 0; 
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0,0,0,1.0); /* Black background with opacity */
    z-index: 2; /* Specifies stacking order relative to other elements */
    cursor: pointer; /* Changes to pointer on hover */
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="overlay"></div>
<span>This text will not be visible when overlay is present.</span>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Develop a scrambled PHP webpage for a CAPTCHA system

I've implemented the cool-captcha feature in my registration form. Here's the code snippet that generates the Captcha image: <img src="captcha.php" id="captcha" /> However, there is an issue where anyone can easily access the "captcha.ph ...

Is there a way to prevent automatically scrolling to the top of the page when submitting a form?

Resolved! By enclosing the input tag within an anchor tag, the issue has been resolved. The question may appear confusing at first, so let me provide some clarification. I created a mail form using PHP. This form is located at the bottom of the page. Whe ...

jQuery Function malfunctioning after initial click

I have developed a function that plays and pauses music. It is designed to be simple and lightweight for small audio samples, with basic play and stop functionalities. The issue I'm encountering is that after playing the music for the second time, the ...

Automatically setting the navbar to expand on medium devices

I am facing an issue while styling my navbar with BS5 installed. I have noticed that the className navbar-expand-md is being assigned, even though I have specified navbar-expand-custom in my code. navbar = _dbc.Navbar( [ _dbc.C ...

Creating dependent dropdowns using Laravel Inertia Vue: A step-by-step guide

In my AddressController, I have a function called loadCity along with other CRUD functions: public function loadCities(Request $request) { $provinceId = $request->province_id; $cities = Province::where('province_id' ...

Change to a different button based on a condition in ReactJS

Currently, I am tackling a ReactJS project that involves the utilization of the following function: function checkMoves() { let index = 0; let moveList = []; while (index < props.moves.length) { if (!moveList.includes ...

HTML2Canvas now offers full compatibility with Scalable Vector Graphics (

Looking to snag a screenshot of a div that contains svg elements and other components using html2canvas. I came across 2 different versions of html2canvas. Version 1 Version 2 What sets them apart, and do either of them support svg elements and work wel ...

What is the best way to incorporate a massive HTML string into a WebView using the LoadHTMLString technique?

I am struggling to display an HTML string on a UIWebView using the 'LoadHTMLString' method. Below is the code snippet I am using: [wv loadHTMLString:[NSString stringWithFormat:@"<!DOCTYPE html><html><head><meta name=\" ...

Refresh Highchart Data with Formatted AJAX Response

I have implemented a Highcharts scatterplot on my webpage with the following structure: $(function() { $('#container').highcharts({ /*chart options, etc... this does not change*/ series: [/*there is some default data ...

Unexpected behavior in grid column layout in Bootstrap 4 has caused some confusion

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous"> <div class="row"> <div clas ...

Guidelines for Effectively Sharing and Managing Typescript Types in Large-Scale Projects across Frontend and Backend

My MERN project has a unique folder structure that includes: backend, which consists of an express mongo backend with the following layout. frontend containing 3 vite react projects, each with their own specific folder setup. Parent Folder: - backend ...

Establishing the highest allowable value limit in cleave

I've integrated cleave.js into my Vue.js project to create a date input field. Here's the option configuration I used: <cleave :options="{ date: true, datePattern: ['m', 'd','Y'] ...

Having trouble finding the element to click the button on a webpage with Selenium?

I've been working on automating clicking a specific button on a webpage using Selenium in Python. The button is labeled 'Download Gamebook (pdf)' and is located on the page 'https://www.nfl.com/games/49ers-at-seahawks-2022-reg-15'. ...

Styling radio buttons with customized CSS borders

I'm attempting to style some radio buttons with a bold red border, but I'm having trouble getting it to display correctly in the latest versions of Firefox and Chrome. It works fine in IE9/IE8. For each input element that is required on my form, ...

Stop automatic scrolling when the keyboard is visible in Angular

I have created a survey form where the user's name appears on top in mobile view. However, I am facing an issue with auto scroll when the keyboard pops up. I want to disable this feature to improve the user experience. <input (click)="onFocusI ...

encase a function with javascript

let myString = "I am creating a program."; //function to calculate number of letters const letterCount = (str) => str.length; //function to calculate number of words const wordCount = (str) => str.split(" ").length; //function ...

Tips for subscribing to an Angular Unit Test:

In the process of writing test cases for a component, I first tackled a basic test case to ensure smooth functionality. Initially, I faced Dependency Injection errors and managed to resolve them. The current challenge I am encountering involves mocking API ...

Inspect only the form fields that have a specific class rather than all fields

I am looking for a way to modify the code below so that it only checks and automatically submits form fields with the class "must_be_filled" instead of every field. Can anyone provide guidance on how I can achieve this? $(document).ready(function() { ...

I need to change a website into a string so that I can analyze it with javascript. How can I do this?

Currently, I am in the process of creating a website for my video game servers. The admin tool we use outputs the current server status in a .json format as a large text string to this specific URL: My goal is to retrieve the entire text string from the p ...

Utilizing PHP Variables in an External JavaScript: A Step-by-Step Guide

I am attempting to utilize an array generated in PHP within my external JavaScript. My PHP code retrieves images from a directory based on the user ID provided via URL and stores them in an array. I aim to use this array in JavaScript to create a photo sli ...