Javascript 计时器倒计时和div在启动计时器之前检查不透明度?jquery
下面是代码Duno为什么它不起作用Javascript 计时器倒计时和div在启动计时器之前检查不透明度?jquery,javascript,jquery,html,timer,Javascript,Jquery,Html,Timer,下面是代码Duno为什么它不起作用 <div id="Timer5min"></div> <div class="loader"> <div class="message phrase1 helvetica">late one christmas morn'...</div> <div class="message phrase2 helvetica">all of the f
<div id="Timer5min"></div>
<div class="loader">
<div class="message phrase1 helvetica">late one christmas morn'...</div>
<div class="message phrase2 helvetica">all of the fragorian children were sleeping...</div>
<div class="message phrase3 helvetica">but there was one little hero who could not wait...</div>
<div class="message phrase4 helvetica" style="visibility: inherit; opacity: 0;"></div>
</div>
我想这是假想状态,因为我没有得到任何关于iv出错的提示。?
什么都没有发生
当不透明度匹配时,它会检查不透明度,然后播放倒计时…我认为你不需要设置TimeOutCountdown,1000;因为函数已经在setInterval内调用
看看这个。这就是你想要的吗?设置超时倒计时,1000;并且设置间隔只有一个;我用chrome进行测试,没关系。我不明白选择器是:“:inherit”你的代码应该做什么?你看到它在做什么?您的浏览器控制台中是否有任何错误?你能提供的关于这个问题的信息越多,我们就越有准备尝试帮助你。
var timer = 301; // 5 minutes worth of seconds + 1 for the first call
function countDown() {
if (--timer) {
var minutes = timer % 60;
if (!minutes) {
minutes = '00';
}
$('#Timer5min').text(Math.floor(timer / 60) + ':' + minutes);
setTimeout(countDown, 1000);
} else {
window.location = 'http://google.com';
}
}
$(document).ready(function () {
var interval = setInterval(function () {
if($('.phrase4').css('opacity') == 0) {
alert();
countDown();
}
}, 1000);
});