我想在创建一段内容后在页面上显示警报横幅 (div
) 30 分钟。 30 分钟后,横幅不应再显示。这是为了让用户知道视频需要时间进行转码
,因此在此之前可能不可用。
想法:
var timeStamp = format_date(var node.created, 'custom', 'M j, Y g:i A');
var currentTime = new Date();
if {
currenTime < timeStamp + (30_minutes) = document.getElementById(alert_banner).style.display = 'block';
}
else {
currentTime > timeStamp + (30_minutes) = document.getElementById(alert_banner).style.display = 'none';
}
最佳答案
你可以试试
var time = 1000 * 60 * 30 //milisecond * second * minute
setTimeout(function(){
// Your function here e.i
document.getElementById(alert_banner).style.display = 'none';
}, time)
关于javascript - 根据时间戳隐藏div容器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22940525/