The basic loading animation in HTML, CSS, and jQuery is not functioning properly on the Chrome browser for

Encountering an issue with what I thought was a simple preloader. It seems to be functioning properly everywhere except for Chrome on iPhone5. The preloader appears but never fades out. Any assistance would be greatly appreciated.

HTML:

<div id="preloader">
    <div class="item item-1"></div>
    <div class="item item-2"></div>
    <div class="item item-3"></div>
    <div class="item item-4"></div>
</div>

CSS

#preloader {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  margin: auto;
  z-index: 999;
  background: red;
  border: solid 3000px white;
}

.item {
  width: 30px;
  height: 30px;
  position: absolute;
  border-radius: 2px;
}

(plus some keyframes not included here)

Script:

$(window).on('load', function() {
  $('#preloader').delay(250).fadeOut();
})

Codepen: https://codepen.io/anon/pen/MBJGMM

Answer №1

Perhaps something like this:

window.onload=function(){
   setTimeout(function(){
      $('#preloader').fadeOut('slow');
   }, 250);
};
#preloader {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  margin: auto;
  z-index: 999;
  background: red;
  border: solid 3000px white;
}

.item {
  width: 30px;
  height: 30px;
  position: absolute;
  border-radius: 2px;
}

.item-1 {
  background-color: #46D1E1;
  top: 0;
  left: 0;
  z-index: 1;
  -webkit-animation: item-1_move 1.2s cubic-bezier(.6,.01,.4,1) infinite;
          animation: item-1_move 1.2s cubic-bezier(.6,.01,.4,1) infinite;
}

.item-2 {
  background-color: #FC487F;
  top: 0;
  right: 0;
  -webkit-animation: item-2_move 1.2s cubic-bezier (.6,.01,.4,1) infinite;
          animation: item-2_move 1.2s cubic-bezier(.6,.01,.4,1) infinite;
}

.item-3 {
  background-color: #885DF1;
  bottom: 0;
  right: 0;
  z-index: 1;
  -webkit-animation: item-3_move 1.2s cubic-bezier(.6,.01,.4,1) infinite;
          animation: item-3_move 1.2s cubic-bezier(.6,.01,.4,1) infinite;
}

.item-4 {
  background-color: #FDC521;
  bottom: 0;
  left: 0;
  -webkit-animation: item-4_move 1.2s cubic-bezier(.6,.01,.4,1) infinite;
          animation: item-4_move 1.2s cubic-bezier(.6,.01,.4,1) infinite;
}
// and the rest of the code
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<div id="preloader">
    <div class="item item-1"></div>
    <div class="item item-2"></div>
    <div class="item item-3"></div>
    <div class="item item-4"></div>
</div>

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

The alignment of the textarea is off due to an issue with the md

I'm experiencing an issue with the alignment of options in my form. The md-maxlength attribute is causing one line to be higher than the rest, as shown in the image below. https://i.sstatic.net/3J3Ts.png My goal is to move that specific textarea one ...

Is the margin missing from the first `li` element in the second column of the `ul`?

How can I apply a top margin to each li element within a ul element that utilizes the css property column-count: 2? I am facing an issue where the margin is being applied to every li element except the first one in the second column: ul { column-count ...

Using React Refs to Trigger the video.play() Method - A Step-by-Step Guide

Is there a way to use a ref in order to trigger video.play()? Currently encountering an error: preview.bundle.js:261916 Uncaught TypeError: _this2.videoRef.play is not a function Take a look at my component: import React from 'react'; import s ...

The drop-down menu is malfunctioning as it is not displaying the complete text and the

At the moment, I am facing an issue where my submenu items for Add Subject, Drop Subject, and Delete Subject are not centralized as intended. Additionally, the Executive Summary text in the submenu is getting cut off. Can someone please help me with expand ...

Oops! We're having trouble locating the react-redux context value. Make sure to wrap the component in a <Provider> to fix this issue. It's all about using Redux with

My debut Next.js website integrated with Redux is running into an issue with the following error: Error: could not find react-redux context value; please ensure the component is wrapped in a The setup involves using _document.js to establish a 'tem ...

The page separator image sinks below the menu

Take a look at the home icon located at the top left corner of this page: If you observe closely, you will notice a small orange line extending below the orange header towards the bottom left of the home button. I have spent hours attempting to adjust it ...

Conceal Div based on user input

There is one input text box for the user and an array with different elements within. When the user types "ha," all elements that do not contain "ha" should be hidden. Whenever the input is triggered, a function is called to hide and display specific ele ...

Accessing database fields through JSON

I am facing an issue with my database that consists of 4 columns (id-symbol-name-contractnumber). While all 4 columns are being displayed on the user interface using JSON, I recently added a new column (countrycode) successfully to the database. However, I ...

implementing a new class for event handling that includes the toggleClass function

I'm not a full-time jQuery or JavaScript developer, so please forgive me if this is a silly question. I believe I require something similar to the live function for swapping classes in order to handle the values associated with a selector. This is th ...

What role does a promise play in rendering code asynchronous?

While we often use promises to avoid the dreaded function callback hell, a question remains: where exactly in the event loop does the promise code execute and is it truly asynchronous? Does the mere fact that the code is within a promise make it asynchron ...

Creating separate UI-views using ui-router within a single module

Can two independent ui-views be created using ui-router for a single module? The objective is to have the ui-views "know" where to display the current state, essentially creating a form of redirection. https://i.sstatic.net/OTNNL.png ...

How can I dynamically generate multiple Reactive Forms from an array of names using ngFor in Angular?

I am in the process of developing an ID lookup form using Angular. My goal is to generate multiple formGroups within the same HTML file based on an array of values I have, all while keeping my code DRY (Don't Repeat Yourself). Each formGroup will be l ...

Struggling with sketching lines in d3.js?

As a first-time user of d3.js and new to JavaScript, I am trying to create a chart that plots three waves, with the third wave partially deconstructing the first two. I have stored the necessary calculations in a JSON object labeled data and have defined t ...

Error receiving by React while updating an array with setState() in TypeScript

I am in search of a way to adjust a property of an item within an array by using the updater returned from setState. The function is passed down as props to the child, who then invokes it with their own index to update their status. const attemptToUpdate ...

What are the functionalities of display flex and block?

I am having trouble with my CSS setup. I have an outer container that wraps around an inner container, which in turn contains two divs. The inner container has a display property of flex, but for small screen sizes, I want the two divs to stack up and disp ...

Unlocking the power of JavaScript/HTML integration in CLR

Is it possible to extract HTML and JavaScript into distinct projects, and then retrieve the code by extracting it from the dll in a different project? Any advice on how to access the code from the dll? This is for distributing modules, specifically in MV ...

Creating a visual representation of a JSON tree using nested <ul> elements in AngularJS

Consider a JSON tree structure like the one shown below: var myTree = { "node": { "name": "A", }, "children": [ { "node": { "name": "B", }, "children": [] }, { "node": { "name": "C", }, ...

The error message "THREE is not defined" indicates a problem

Hey there! I've been experimenting with running some three.js examples on my local machine. I ran into some security issues, so I set up a local server using Python. While the background image and text appear as expected, the animations are not workin ...

Tips for positioning divs at the bottom of the screen while making them inline and overlapping their parent div

Is there a way to make divs display at the bottom of the screen in a horizontal line, overlapping their parent div just like Facebook chat? I have attempted the following code but it doesn't seem to work. <div id="container"> <div class=" ...

Transforming an array of Instagram photos into an array specifically consisting of chosen photos

Trying to configure my Instagram API website to allow users to pick photos. I have managed to store the data in a database and display the photos, but I'm struggling to enable photo selection in a different array. Below is the code snippet: <?ph ...