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/