最初moto
隐藏10s;
10 秒后它应该可见。
保持可见 - 15 秒。
隐藏
再一次:
- 隐藏的 10s...
这是我的尝试,没有成功 - moto
从未显示。
function go_anima(){
$("#moto").hide();
setTimeout(function(){$("#moto").fadeIn();}, 10000);
}
$(document).on('ready', function(){
setInterval(function(){go_anima();}, 25000);
});
.moto{display:none;}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div class='moto' id='moto'>LOREM IPSUM</div>
最佳答案
文档没有发出“就绪”事件1:
$(document).on('ready', function(){
相反,您需要就绪
方法:
$(document).ready(function(){
或者,首选,只是:
$(function(){
1“就绪”事件在旧的 jQuery 版本中可用,如 documentation 中所述:
There is also
$(document).on( "ready", handler )
, deprecated as of jQuery 1.8 and removed in jQuery 3.0.
关于javascript - 具有 setTimeOut 的 setInterval 调用函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59535837/