My preload is not working and I tried in several ways and I can not help myself

1

This is the code that is trying to preload only that the fadeOut effect is not working when I put Jquery, I already checked that it is pulling the file, it just does not execute the fadeOut to appear the page, I am very grateful for the help . I'm using bootstrap 3.

My HTML

<!doctype html>
<html lang="pt-br">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- Bootstrap -->
    <link href="css/bootstrap.css" rel="stylesheet">
    <link href="style.css" rel="stylesheet">
        <link href="animate.css" rel="stylesheet">

    <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.10/css/all.css" integrity="sha384-+d0P83n9kaQMCwj8F4RJB66tzIwOKmrdb46+porD/OvrJ+37WqIM7UoBtwHO6Nlg" crossorigin="anonymous">

<body>
<!--Preload start-->
  <div class="loaded">  
    <div class="spinner">
        <div class="bounce1"></div>
        <div class="bounce2"></div>
        <div class="bounce3"></div>
    </div>
  </div>
  <!--Preload start-->
  <!-- jQuery (obrigatório para plugins JavaScript do Bootstrap) -->
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script><!--Incluitodosospluginscompilados(abaixo),ouincluaarquivosseparadadossenecessário--><scriptsrc="js/bootstrap.js"></script>
    <script type="text/javascript" src="script.js"></script>
<body>
<html>

My CSS

.loaded{position: fixed; top:0; left: 0;bottom: 0; width: 100%; height: 100%; z-index: 10000; background-color: #0473AA }

.spinner {
  margin: 300px auto 0;
  width: 70px;
  height: 100%;
  text-align: center;
}

.spinner > div {
  width: 18px;
  height: 18px;
  background-color: #fff;

  border-radius: 100%;
  display: inline-block;
  -webkit-animation: sk-bouncedelay 1.4s infinite ease-in-out both;
  animation: sk-bouncedelay 1.4s infinite ease-in-out both;
}

.spinner .bounce1 {
  -webkit-animation-delay: -0.32s;
  animation-delay: -0.32s;
}

.spinner .bounce2 {
  -webkit-animation-delay: -0.16s;
  animation-delay: -0.16s;
}

@-webkit-keyframes sk-bouncedelay {
  0%, 80%, 100% { -webkit-transform: scale(0) }
  40% { -webkit-transform: scale(1.0) }
}

@keyframes sk-bouncedelay {
  0%, 80%, 100% { 
    -webkit-transform: scale(0);
    transform: scale(0);
  } 40% { 
    -webkit-transform: scale(1.0);
    transform: scale(1.0);
  }
}

jquery code

Jquery(window).load(function){
   Jquery("#spiner").fadeOut();
   Jquery("#loaded").delay(1000).fadeOut("slow");
}
    
asked by anonymous 26.04.2018 / 00:40

1 answer

2

You are using the wrong event:

$(window).load(...

The .load method refers to Ajax requests. You should use the event .on load :

$(window).on("load",function(){...

Looking like this:

$(window).on("load",function(){
   $("#spiner").fadeOut();
   $("#loaded").delay(1000).fadeOut("slow");
});
    
26.04.2018 / 01:04