如果秒=1,停止倒计时3秒,转到秒=0
If second = 1, stop countdown for 3 seconds, the go to second = 0
我有一个拍卖网站的倒计时。在拍卖结束时,我想展示"进行一次"。"去两次"answers"最后一次"就像真正的拍卖。此代码在second=3显示"进行一次",在second=2显示"进行两次",并在second=1显示"final call"。
if(hours == "00" && minutes == "00")
{
if(seconds < 50) {
var color = thisDiv.css("background-color");
thisDiv.animate({color:"red"}, 'fast');
thisDiv.animate({color: "black"},'fast') ;
}
if(seconds == 3)
{
$(this).html("Going once!");
}
if(seconds == 2)
{
$(this).html("Going twice!");
}
if(seconds == 1)
{
$(this).html("Final call!");
}
if(seconds == 0)
{
//$('.auction-current-time').countdown('destroy');
//$('.auction-current-time2').html("Auction Ended");
$(this).html("GONE!");
$(".mm_bid_mm").hide();
//alert("asd");
}
}
我想把这个代码改为只在second=0之前显示"进行一次"、"进行两次"answers"最终调用",每个都应该显示1s。
我不知道该怎么做。
非常感谢你的帮助和建议。
我已经制作了一个倒计时时钟的快速模型,大致使用了这里的内容:http://jsfiddle.net/uqxn2jhr/
var countDownClock = function (hours, minutes, seconds) {
var clock = $('[data-countdown="clock"]');
var time = $('[data-countdown="time"]');
var quick = $('[data-countdown="quick"]');
time.html(
((hours < 10) ? '0' : '') + hours + ':' + ((minutes < 10) ? '0' : '') + minutes + ':' + ((seconds < 10) ? '0' : '') + seconds);
if (hours === 0 && minutes === 0) {
if (seconds == 3) {
quick.html("Going once!");
}
if (seconds == 2) {
quick.html("Going twice!");
}
if (seconds == 1) {
quick.html("Final call!");
}
if (seconds == 0) {
//$('.auction-current-time').countdown('destroy');
//$('.auction-current-time2').html("Auction Ended");
quick.html("GONE!");
//$(".mm_bid_mm").hide();
//alert("asd");
}
}
}
var beginCountDown = function (hours, minutes, seconds) {
var countDown = setInterval(function () {
seconds = seconds - 1;
console.log(seconds);
if (seconds < 0 && (minutes > 0 || hours > 0)) {
//reset seconds and reduce hours/minutes
}
if (seconds >= 0) {
countDownClock(hours, minutes, seconds);
} else {
clearInterval(countDown);
countDown = null;
}
}, 1000);
};
beginCountDown(0, 0, 10);
这对你的问题有帮助吗?
谢谢你的回答,我想要更像这样的东西:
if(seconds == 4)
{
//$(this).html("Going once!");
}
if(seconds == 3)
{
//$(this).html("Going twice!");
}
if(seconds == 2)
{
//$(this).html("Final call!");
}
if(seconds == 1)
{
$('#box1').delay(1800).show('slow').promise()
.then(function(){ return $('#box2').delay(1800).show('slow').promise(); }).then(function(){ return $('#box2').delay(1800).hide('slow').promise(); }).then(function(){
return $('#box3').delay(1800).show('slow').promise(); }).then(function(){
return $('#box3').delay(1800).hide('slow').promise(); });
}
if(seconds == 0)
{
$(this).html("Bidding ended!");
}
我想在显示#box1时添加1,然后在显示#box2时添加1。我不确定是否可能…谢谢
我使用query.countdown.js(http://keith-wood.name/countdown.html)
相关文章:
- 如果30秒未单击,请应用CSS一次,将其删除,然后重新迭代
- 如果未按下该按钮,则在30秒内自动执行该功能
- 如果某个值在另一个节点中,我如何每秒自动单击一个链接
- 如果页面加载时间超过 10 秒,如何刷新页面
- 如果有办法在 N 秒内加载未触发,则有没有办法设置 img src
- 如果发现任何数据,如何停止每7秒运行一次的函数
- 如果我们在5秒后有一个隐藏间隔,则无法获取Growl消息
- 如果在一段时间不活动后4秒内开始加载,如何刷新我的网站
- 提交时,X 秒后,如果窗口模糊
- 如果用户在 5 秒内未滚动,如何平滑滚动到定位点
- 如果少于两秒的呼叫功能2,我如何才能按住按钮进行两秒呼叫功能1
- 如果秒=1,停止倒计时3秒,转到秒=0
- 如果秒数=0,则更改背景主体颜色
- 如果输入错误,将文本输入保持为只读状态4秒
- 如果之前在X秒内调用,则阻止并排队执行操作(但仅全局执行一次)
- 如果函数没有't在3秒内被调用了N条记录中的1条
- 在'x'如果未单击触发器,则为秒
- Javascript点击按钮,如果不活动60秒
- 如果在x秒后调用函数
- 如何重新加载一个选项卡,如果它不是活动的每5秒