Tips for ensuring the preloader completely covers the height of the page and hides all loading elements

How can I ensure that the preloader covers the entire height of the page and no loading elements are visible?

Whenever I run this code, the content inside is visible when I scroll down. How can I make sure that the preloader background covers the entire page?

HTML:

<div class="pre-outer">
    <div class="preloader">

    </div>
  </div>
<section class="home-section-background padding-bottom-0">
</section>

CSS:

/* Loader Styles */
    .pre-outer
    {
      background: rgba(1,1,1,1);
      width: 100%;
      z-index: 999;
              height: 100%!important;
    }
    .preloader {
       display: -webkit-box;
      display: -ms-flexbox;
      display: flex;
      overflow-y: hidden;
      -webkit-box-pack: center;
          -ms-flex-pack: center;
              justify-content: center;
      -webkit-box-align: center;
          -ms-flex-align: center;
              align-items: center;

      overflow: hidden;
      background: rgba(1,1,1,1);
      width: 100%;
      position: absolute;
              z-index: 999;
              height: 100%!important;
      -webkit-animation: glow 8s both;
              animation: glow 8s both;

    }

Javascript code for loader:

<script>
$(window).load(function () {


            $('.pre-outer').delay(8000).fadeOut('slow');//loader div

        });
</script>

Answer №1

It's not essential to cover the entire height of the content. Simply change the position of the preloader from absolute to fixed;

position: fixed;
top: 0;
left: 0;
height: 100%;

Answer №2

Try changing position: absolute to position: fixed. This will ensure that the overlay stays on the screen even while scrolling:

/*loader styles */
    .pre-outer
    {
      background: rgba(1,1,1,1);
      width: 100%;
      z-index: 999;
              height: 100%!important;
    }
    .preloader {
       display: -webkit-box;
      display: -ms-flexbox;
      display: flex;
      overflow-y: hidden;
      -webkit-box-pack: center;
          -ms-flex-pack: center;
              justify-content: center;
      -webkit-box-align: center;
          -ms-flex-align: center;
              align-items: center;

      overflow: hidden;
      background: rgba(1,1,1,1);
      width: 100%;
      position: fixed;
              z-index: 999;
              height: 100%!important;
      -webkit-animation: glow 8s both;
              animation: glow 8s both;

    }

To completely disable scrolling during the loading screen, you can set an overflow hidden and a fixed height on the body element. Remember to remove this after the preloader closes to avoid any sudden jumps in content when the scrollbar reappears.

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

Issues with alignment arise when adjusting the font size of labels using radio buttons in Bootstrap

Currently, I am dealing with an issue related to the alignment of radio buttons and their labels in the bootstrap style. The problem becomes apparent when I adjust the font size of the label: the radio button remains the same size in its original position ...

What is the best way to convert an "add a friend" link into a button? It has a different purpose compared to a "send message" link

The feature of sending a private message functions like a button <div><a href="<?php bp_send_private_message_link() ?>" class="myButton"></a></div> when placed in the PHP file below: <!DOCTYPE html PUBLIC "-//W3C//DTD XH ...

Exasperated over a malfunctioning jQuery guide?

I recently started learning jQuery and I've been following a series of video tutorials. Today, I tackled the first tutorial which introduced how to fadeout a simple <a> tag. I diligently wrote the code provided in the video, but unfortunately, i ...

Generate a query string by selecting certain input values using a button, while disregarding the rest

Currently working on a project involving a large calculator designed as a form, which contains 150 inputs. My goal is to generate a query string using only 17 of these inputs for the user to share. I am utilizing PHP to populate the inputs from the URL s ...

After achieving success in displaying my navigation, I am currently facing difficulty in hiding it using the following code

I'm struggling with my code that handles navigation functionality. It shows the navigation when clicked, but I can't seem to make it hide again: $(".main-nav").hide(); $(".menu-btn-container .menu-toggle").click(function() { $( ...

Encoding large files using the Base64 format

Is there a method to encode a file of, say, 2 gigabytes without splitting it into chunks? I am encountering errors when trying to handle files larger than 2GB due to their size being too large for the filesystem. Breaking the file into smaller chunks is ...

The functionality of the Ajax call ceases to function properly on mobile devices after a period of time

I'm currently developing a mobile application using Cordova, AngularJS, and jQuery. My issue lies in trying to retrieve two files from the same directory. The first file retrieval is successful and occurs immediately after the page loads. However, t ...

Utilizing the HasMany - BelongsTo relationship in Ember.js with the RESTAdapter

Can anyone provide guidance on creating a has many belongs to relationship using RESTAdapter in EmberCLI? I am working on a project where a card (representing a Twitter user) can have multiple hashtags associated with it. Here are my model definitions: / ...

When opting for "Not now" in Firefox, the error callback in getUserMedia is not activated

I am currently working on a script to detect when the user either allows or denies the use of a microphone using the getUserMedia API. UPDATE: To better illustrate the issue I am facing, I have created a fiddle: http://jsfiddle.net/4rgRY/ navigator.getUs ...

When utilizing the new:true option in MongoDB, it provides access to the previous value

Within my MongoDB v2.2 NodeJS 0.8 MongoSkin 0.5 Framework setup, I have implemented the following code: var db = mongo.db(admin+"@127.0.0.1:27017/database",{safe:true}); db.collection('collection').findAndModify({'code':code,'emai ...

The contents of the Xml file are not appearing correctly in the list when viewed on Wamp

Recently, I delved into the realm of Ajax methods after browsing through W3schools and attempting to incorporate their teachings from a video tutorial. The specific video can be found at: After coding and placing the necessary files in the www directory o ...

Retrieve the directory's last modification time when the file is altered

I'm attempting to retrieve the last modified time (mtime) of a directory. I'm unsure if my current approach is correct, so I'm wondering how I can capture the mtime when a file within the directory is altered. This is what I'm currentl ...

Issues arise when Django static files fail to load without any error indicators

Upon running the django server and attempting to load HTML files, I encountered an issue where CSS files were not loading. There were no visible errors on either the terminal or the website itself, just a loading animation in the background. To address thi ...

Encountering a TypeError in Mongoose: Unable to access properties of undefined while trying to read 'find'

Encountering an issue with the error message, TypeError: Cannot read properties of undefined (reading 'find'), specifically pointing to this block of code: app.get('/Organizations', (req,res) => { Organizations.find({}).then((organiz ...

What could be causing the white gap beneath my homepage?

I have successfully created a website that utilizes buttons for navigation, with everything working smoothly except for the homepage. On the homepage, there seems to be excessive white space below all the content. I attempted to fix this by setting overflo ...

How can a prop function in Reactjs be utilized to perform various tasks and return specific values based on the necessary conditions?

I have a function stored in my parent component that is passed down to the child components as a prop. Within one of the child components, I need to execute this function twice. The first time, with specific arguments, and return a value from that particul ...

The package.json for this location is available, yet the node_modules directory is absent

Attempting to launch a Redux application that has been cloned from a GitHub repository. The command used to start it was npm start An error message is being received > <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail=" ...

personalizing jquery templates

Currently, I am utilizing a jQuery template to showcase specific values. Within this template, I have included an if statement to determine if the age is considered old or not, with the result altering the background color accordingly. Previously, the co ...

Automatically selecting and fetching checkbox values using JavaScript

I was struggling with coding a function that involved generating checkboxes using JavaScript. My goal is to automatically select the elements "March" and "September" from the array target[] and display them as checked in the text area. So, "March" and "Se ...

Guide on declaring package.json during library publication in Angular 6

Building node modules using Angular6 should be a breeze. The Documentation outlines the following steps: ng generate library YOUR-LIBRARY ng build YOUR-LIBRARY --prod cd dist/YOUR-LIBRARY && npm publish By following these steps, a new project wi ...