我在JavaScript中执行Settimeout Loaing符号



javaScript settimeout工作良好。但是不透明度从1至0.5开始。如何在SettieMout模式下固定不透明度0.50?

jQuery(document).ready(function() {
  document.getElementById('load').style.visibility = "visible";
  document.getElementById('load').style.width = '100' + '%';
  document.getElementById('load').style.height = '100' + '%';
  document.getElementById('load').style.position = 'initial';
  document.getElementById('load').style.backgroundImage = "url('image/load.gif')";
  jQuery('#load').fadeOut(3000);
});
#load {
  background-repeat: no-repeat;
  background-position: center;
  opacity: 0.50 !important;
  z-index: 999;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<body>
  <div id='load'>
  </div>
</body>

查看以下内容。尝试使用animate

var x = document.getElementById('load');
$(x).animate({opacity:0.5},3000);

希望这会有所帮助..!

您可以像以下方式一样做:

html,CSS和JS

jQuery(document).ready(function() {
  setTimeout(function() {
    jQuery('#load').removeClass('active');
  }, 1000)
});
#load {
  position: fixed;
  height: 100%;
  width: 100%;
  top: 0;
  left: 0;
  transition: 0.5s;
  text-align: center;
  display: none;
}
#load.active {
  display: block;
  transition: 0.5s;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id='load' class="active">
  <img src="https://upload.wikimedia.org/wikipedia/commons/b/b1/Loading_icon.gif">
</div>

这是jsfiddle链接

最新更新