firefox - Firefox 没有正确触发 setInterval
问题描述
我正在运行以下脚本,以便在视频完全加载后隐藏预加载器。
它工作得很好——但有时这不会在 Firefox 中触发并保持预加载器无限加载。在 Chrome 和 Safari 中运行良好。
这与setInterval有关吗?
谢谢
function checkforLoad() {
//Every 500ms, check if the video element has loaded
var b = setInterval(()=>{
if(vid.readyState === 4){
//This block of code is triggered when the video is loaded
console.log("Video is loaded");
$('#intro').fadeOut(300);
//stop checking every half second
clearInterval(b);
}
},300);
}
解决方案
推荐阅读
- jenkins - 该请求中不包含有效的面包屑
- javascript - 将 js 数组转换为字典/哈希图
- java - 组合框不使用 setCellFactory 添加元素
- profiler - Xcode GPU 着色器分析器
- android - 如何接听和拨打电话?
- c++17 - clang 6.0.0 版:clang++“命名空间‘std’中没有名为‘make_optional’的成员”
- scala - 是否有相当于 python 目录的 Scala?
- c# - Unity 自动隐藏面板
- docker - 在 Visual Studio 中禁用 Docker
- reactjs - 我可以将函数作为道具传递并让它修改子组件中的其他道具吗?