javascript - 如果无法加载,如何隐藏图像/视频
问题描述
如果无法在网站中加载,我希望能够隐藏 img/video
解决方案
您需要使用 javascript,用于视频。
x = document.getElementById("video");
x.addEventListener('error',function(){
$(x).hide();
});
推荐阅读
- ms-access - MS Access 365 - 创建包含链接文件的子表单
- css - 为什么我的 Gatsby/Material-UI 站点呈现的比视口略大?
- azure - 在 azure ml 管道中,使用大型数据集训练模型时出错
- bash - 如何检查 bash 脚本的参数是否为“标志”
- ios - Ionic:不再接受 iOS UIWebView
- c# - 有谁知道为什么 C# 语音识别突然不再起作用了?
- python - 如何提高迭代的性能
- sass - Hugo loveit 主题中的样式定制
- ansible - ansible:在when语句中访问最后一个库存列表项/列表大小
- python-3.x - 如何在烧瓶管理页面中以人类可读文本显示关系数据