Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/459.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/42.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 实现jCounter_Javascript_Css - Fatal编程技术网

Javascript 实现jCounter

Javascript 实现jCounter,javascript,css,Javascript,Css,我一直在尝试实现这个页面,除了jCounter,我已经设置好了所有东西。如何更改活动时间?我试着查找jCounter页面,但没有帮助。我是个普通的初学者,希望你能帮我 我所尝试的: 更改代码的这一部分: 设置为自定义日期,并将格式设置为“on” 但是我认为上面的设置只是在开始之前用null值初始化值?如果是这样,我在哪里输入倒计时的事件日期?我检查了index.html文件,它只有countdown.js调用和css应用,eventdate从未被提及。因此,通过这些设置,计数器从198天开始倒计

我一直在尝试实现这个页面,除了jCounter,我已经设置好了所有东西。如何更改活动时间?我试着查找jCounter页面,但没有帮助。我是个普通的初学者,希望你能帮我

我所尝试的: 更改代码的这一部分:

设置为自定义日期,并将格式设置为“on”

但是我认为上面的设置只是在开始之前用null值初始化值?如果是这样,我在哪里输入倒计时的事件日期?我检查了index.html文件,它只有countdown.js调用和css应用,eventdate从未被提及。因此,通过这些设置,计数器从198天开始倒计时。我不确定这次活动的日期是从哪里来的。任何帮助都将不胜感激。谢谢


这是计数器教程的链接:

您是否尝试过文档中的确切示例

$(document).ready(function() {

  $("#countdown").countdown({
    date: "25 december 2014 1:00:00", // add the countdown's end date (i.e. 3 november 2012 12:00:00)
    format: "on" // on (03:07:52) | off (3:7:52) - two_digits set to ON maintains layout consistency
  },

  function() { 

    // the code here will run when the countdown ends
    alert("Santa on the roof!");

  });
});
尝试运行下面的代码段

(函数($){
$.fn.countDown=函数(选项){
config={};
$.extend(配置,选项);
diffSecs=this.setCountDown(配置);
$('#'+$(this.attr('id')+'.digit')).html('');
$(this).doCountDown($(this).attr('id'),diffSecs,500);
if(config.onComplete)
{
$.data($(this)[0],'callback',config.onComplete);
}
如果(config.com)
{
$.data($(this)[0],'omit weeks',config.omit weeks);
}
归还这个;
};
$.fn.stopCountDown=函数(){
clearTimeout($.data(此[0],“计时器”);
};
$.fn.startCountDown=函数(){
this.doCountDown($(this.attr('id'),$.data(this[0],'diffSecs'),500);
};
$.fn.setCountDown=函数(选项){
var targetTime=新日期();
如果(选项。目标日期)
{
targetTime.setDate(options.targetDate.day);
targetTime.setMonth(options.targetDate.month-1);
targetTime.setFullYear(options.targetDate.year);
targetTime.setHours(options.targetDate.hour);
targetTime.setMinutes(options.targetDate.min);
targetTime.setSeconds(options.targetDate.sec);
}
else if(options.targetOffset)
{
targetTime.setDate(options.targetOffset.day+targetTime.getDate());
targetTime.setMonth(options.targetOffset.month+targetTime.getMonth());
targetTime.setFullYear(options.targetOffset.year+targetTime.getFullYear());
targetTime.setHours(options.targetOffset.hour+targetTime.getHours());
targetTime.setMinutes(options.targetOffset.min+targetTime.getMinutes());
targetTime.setSeconds(options.targetOffset.sec+targetTime.getSeconds());
}
var nowTime=新日期();
diffSecs=Math.floor((targetTime.valueOf()-nowTime.valueOf())/1000);
$.data(此[0],'diffSecs',diffSecs);
返回差秒;
};
$.fn.doCountDown=函数(id、diffSecs、持续时间){
$this=$(“#”+id);
if(diffSecs 0)
{
e=这一美元;
t=setTimeout(函数(){e.doCountDown(id,diffSecs-1)},1000);
$.data(e[0],'timer',t);
} 
else if(cb=$.data($this[0],'callback'))
{
$.data($this[0],'callback')();
}
};
$.fn.dashChangeTo=函数(id、破折号、n、持续时间){
$this=$(“#”+id);
d2=n%10;
d1=(n-n%10)/10
if($('#'+$this.attr('id')+'.+dash))
{
$this.digitChangeTo('#'+$this.attr('id')+'.+dash+'.数字:第一个',d1,持续时间);
$this.digitChangeTo('#'+$this.attr('id')+'.+dash+'.digit:last',d2,duration);
}
};
$.fn.digitChangeTo=函数(数字,n,持续时间){
如果(!持续时间)
{
持续时间=800;
}
如果($(数字+'div.top').html()!=n+“”)
{
$(数字+'div.top').css({'display':'none'});
$(数字+'div.top').html((n?n:'0')).slideDown(持续时间);
$(数字+'div.bottom')。动画({'height':''},持续时间,函数(){
$(digit+'div.bottom').html($(digit+'div.top').html());
$(数字+'div.bottom').css({'display':'block','height':''});
$(数字+div.top').hide().slideUp(10);
});
}
};
$(文档).ready(函数(){
$('cd#u 1')。倒计时({
目标日期:{
"天":25,,
"月份":12,,
“年份”:2014年,
“小时”:20,
"敏":25岁,,
“秒”:0,
“utc”:正确
},这是真的
});
});
})(jQuery)
.card{
显示:内联块;
利润率:10px;
填充物:5px;
边框:2个实心#ccc;
背景:ddd;
最小宽度:340px;
最小高度:80px;
}
.倒计时仪表板{
字体系列:无衬线;
字体大小:12px;
颜色:#444;
}
.头衔{
字体系列:无衬线;
字体大小:20px;
字号:100;
颜色:#002244;
}
.lbl{
字体系列:无衬线;
字号:19px;
字号:100;
颜色:#666;
}
.pad{
右侧填充:30px;
}
.row img{
填充:18px 8px 0;
}
.达什{
高度:14px;
浮动:左;
位置:相对位置;
文本对齐:居中;
}
.破折号.数字{
背景:#444;
颜色:#fff;
边框:2倍实心#333;
字体大小:30px;
浮动:左;
位置:相对位置;
利润率:0.6px 0.0;
填充:7px 5px 5px 5px;
}

根据调查,你将死于埃博拉。。。
天
小时
分钟
秒

你能为这个制作一个JSFIDLE链接吗?是的,当然可以:看看我在本月初制定的海鹰队比赛日程安排
$(document).ready(function() {

  $("#countdown").countdown({
    date: "25 december 2014 1:00:00", // add the countdown's end date (i.e. 3 november 2012 12:00:00)
    format: "on" // on (03:07:52) | off (3:7:52) - two_digits set to ON maintains layout consistency
  },

  function() { 

    // the code here will run when the countdown ends
    alert("Santa on the roof!");

  });
});