My Mayor isn’t working and I’ve tried many ways and I can’t help myself

Asked

Viewed 97 times

1

This is the code that I am trying to do the file only that the fadeOut effect is not working when I put Jquery, I have already verified that it is pulling the file only does not run the fadeOut to appear the page, I am very grateful for the help. I’m wearing the 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>
   <!-- Inclui todos os plugins compilados (abaixo), ou inclua arquivos separadados se necessário -->
    <script src="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");
}

1 answer

2


You’re using the wrong event:

$(window).load(...

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

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

Thus remaining:

$(window).on("load",function(){
   $("#spiner").fadeOut();
   $("#loaded").delay(1000).fadeOut("slow");
});
  • Thank you very much. I can’t believe I didn’t notice this hehehe. vlw.

  • Thank you very much. I can’t believe I didn’t notice this hehehe. vlw.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.