Why is the background object still showing in HTML after implementing z-index?

I'm currently working on a popup to display some preload content, but unfortunately it's not functioning properly. Instead of showing the preload content, it's displaying another element.

<html>
    <script src="http://www.flygoldfinch.com/wp-includes/js/jquery.min.js"></script>
    <script src="http://www.flygoldfinch.com/wp-includes/js/nprogress.js"></script>
    <link rel="stylesheet" type="text/css" href="http://www.flygoldfinch.com/wp-includes/css/nprogress.css">
    <script>
    jQuery(document).ready(function() {
        jQuery('body').append('<div id="pbwrapper" style="width: 100%; position: fixed; left:0; top: 0; opacity:1; height: 800px; margin: 50px auto 0px auto; text-align: center; z-index: 10000; background-color : #fff;" > <h1 class="headline tac sans-serif">Wait while we loading Awesomeness</h1> </div>');
        NProgress.start();
        setTimeout( 
            function(){ 
                NProgress.done();
                jQuery('#pbwrapper').remove();
            }, 9000 
        );
    });
    </script>
    <body>
        <div id="wrapper">This is wrapper</div>
    </body>
</html>


The popup is generated dynamically using jQuery.
I made changes to the id "wrapper".
Is there something wrong with my CSS? I set the position of the popup to be fixed. You can see a screenshot of the issue here.

Answer №1

There has been an error in the jQuery code where a margin was mistakenly added. It should either be removed or set to 0. Additionally, @Vinayak is correct in recommending that the height be set to 100%.

To make the necessary changes:

height: 800px; margin: 50px auto 0px auto;

Update the code to:

height: 100%; margin: 0;

Answer №2

<div id="container">This is container</div>

The container div is positioned in the background, while the Pop up div appears on top of your HTML body layer with a fixed height of 800px, set to occupy 100% of the available space.

When using jQuery's append method, it will add your HTML content at the end of the body section.

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

Incorporate the Bootstrap classes to arrange the divs side by side, ensuring that any surplus space is utilized effectively

Having implemented a layout with two images and two paragraphs side by side, everything seemed to be working fine until I encountered an issue when setting both images' height to 400px. The goal was for the paragraph to adjust its size based on conten ...

Using the timer function to extract data within a specific time frame - a step-by-step guide

Is there anything else I need to consider when the temperature increases by 1 degree? My plan is to extract data from my machine for the last 30 seconds and then send it to my database. set interval(function x(){ If(current_temp != prev_temp){ if((c ...

Interacting with HTML5 canvas using object events

How can I assign an event handler to an element created on the HTML5 Canvas without having to manually track specific coordinates? ...

What are the ramifications of using the 'new' keyword in JavaScript?

Currently, I am in the process of developing a plugin for jQuery, and I am encountering a JSLint error that redirects to JSLint: Problem at line 80 character 45: Do not use 'new' for side effects. (new jQuery.fasterTrim(this, options)); Despit ...

Best practices for handling http requests in each individual route of AngularJs

Just starting out with AngularJs and attempting to set up multiple routes with different $http requests. I'm facing an issue where the page content loads late after a route change. I've come up with a workaround, but I feel like there might be a ...

What is the reason that <span> elements do not automatically wrap around to the next line when they are in line with each other without any white space?

Once upon a time, I believed that line breaks had no impact on the rendering of HTML due to minification. However, I recently discovered something peculiar. <!DOCTYPE html> <html> <body> <style> div { width: 200px; background: ...

Developing an Asp.net web application that interacts with the SharePoint object model

I am currently working on an asp.net 2.0 web application that needs to coexist with SharePoint Server 2007 on the same web servers. The application must have its own App Pool in IIS 6.0 and will need to utilize the SharePoint Object model API. Is there a ...

Mastering React children: A guide to correctly defining TypeScript types

I'm having trouble defining the children prop in TypeScript for a small React Component where the child is a function. class ClickOutside extends React.PureComponent<Props, {}> { render() { const { children } = this.props; return chi ...

Showing perspectives that include 'partial'/'nested' components in EXTjs 4

I am struggling to comprehend how I should define and implement the MVC model for my test application in EXTjs4. Let's take a look at the structure below. app.js Ext.application({ name: 'AM', appFolder: 'app', control ...

Optimizing ajax speed when loading large lists from the backend

For the CRUD operations in my application, I retrieve all items from the backend and display them on the front-end by looping through them using JavaScript, specifically utilizing ajax. Picture my app as a to-do list. Whenever a user adds a new item, do I ...

Is there a method to access the output of getStaticProps function from NextJS API routes?

Is there a method to compute and cache new data during build time that is essential for both the front-end and back-end API routes? I'm looking for a way to access the static properties generated by API routes at build time since the routes are access ...

Decreasing the space between columns in Bootstrap 3

My objective is: https://i.sstatic.net/UIPsq.png However, the current layout appears like this (the issue isn't the bottom margins, I've already decided they should be smaller): https://i.sstatic.net/GbLFE.png The problem lies in the gutter s ...

Implementing dynamic paths for mongoose updates

Below is the structure of my model: var eventSchema = new mongoose.Schema({ 'eventTitle': String, 'location': String, 'startDate': String, 'endDate': String, 'startTime': String, &a ...

Tips for detecting a new day with server-side JavaScript

I am currently developing a website that includes a schedule for teachers. I have encountered the need to delete elapsed days data from a database. What is the most effective method to monitor when it is exactly 12 midnight? If I were to use setInterval( ...

What is the best way to develop a PHP proxy script to manage CORS problems when making API requests?

I am facing an issue where I need to call an API, but due to CORS problems, I have to create a PHP proxy file. However, the PHP code I wrote does not seem to be working as expected, leaving me stuck. Below is the script I'm using to make the API call ...

How to set the element in the render method in Backbone?

Currently, I am in the process of developing a web page utilizing BackboneJS. The structure of the HTML page consists of two divs acting as columns where each item is supposed to be displayed in either the first or second column. However, I am facing an is ...

Ensuring the presence of Objects/Functions in different browsers using javascript

I am seeking advice on the best practices for testing object existence for cross-browser compatibility. There are numerous methods available for testing whether an object/function/attribute exists. While I could utilize jQuery or another library, my prefe ...

When running nodemon in an npm project without any arguments, it fails to execute the value specified in the "main" field of the package.json

My current npm project has the following folder structure: project ├── node_modules │ └── (node_modles folders) ├── server.js ├── index.js ├── index.html ├── package.json └── package-lock.json The JavaScr ...

Struggling to locate the correct setup for .babel and react-hot-loader

I am currently utilizing babel 7. In their documentation, they specify that the new naming convention for plugins should include the @babel/ prefix. The recommended React-hot-loader babelrc configuration is as follows: { "plugins": ["react-hot-loader/ ...

Transforming a horizontal list into a vertical one

What might be causing the message list to display horizontally in the admin dashboard, but vertically on other pages? .user-list{ display:inline; } .users header, .users-list a{ display: flex; align-items: center; padding-bottom: 20px; border-bottom: 1px s ...