javascript - 我在 javascript 中执行 setTimeout 加载符号?

标签 javascript html css

Javascript setTimeout 运行良好。但不透明度从 1 到 0.5 开始。如何在setTimeout模式下将不透明度固定为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);

希望这有帮助..!

关于javascript - 我在 javascript 中执行 setTimeout 加载符号?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48700841/

相关文章:

PHP 目录警告和 require 的 fatal error

html - 以固定比例向 float div添加边框

css - Bootstrap 4 : validation breaks styling on inline form elements?

html - 如何让文字在图片上居中?

javascript - 从字符串中删除字符

javascript - 带有 requestanimationframe 的 Canvas 鼠标事件

javascript - 如何让内部 eslint 插件在没有 eslint-plugin-* 前缀的情况下工作

javascript - Webstorm JavaScript 和 Typescript zen 编码

javascript - 日期时间日历 : select date range in a single input field

jquery - 我的 jQuery 在加载内容之前获取元素的宽度和高度