我正在使用keith-wood Jquery倒计时。我的示例代码如下
<link rel="stylesheet" type="text/css" href="http://keith-wood.name/css/jquery.countdown.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript" src="http://keith-wood.name/js/jquery.plugin.js"></script>
<script type="text/javascript" src="http://keith-wood.name/js/jquery.countdown.js"></script>
<script>
$(function () {
var austDay = new Date();
austDay = new Date(austDay.getFullYear() + 1, 1 - 1, 26);
$('.countdown1').countdown({until: austDay});
$('.countdown2').countdown({until: austDay, format: 'HMS'});
});
</script>
Countdown1:
<div class="countdown1"></div><br/><br/><br/>
Countdown2:
<div class="countdown2"></div>
我想更改第二个div的时钟文本。例如,我想将Hour转换为Hr,Minutes转换为Min和Seconds,仅用于countdown2。
答案 0 :(得分:2)
你需要这个:
初始化labels:
时,按照您的要求设置countdown
,如下所示:
labels: ['Years', 'Months', 'Weeks', 'Days', 'Hrs', 'Min', 'Sec']
$(function () {
var austDay = new Date();
austDay = new Date(austDay.getFullYear() + 1, 1 - 1, 26);
$('.countdown1').countdown({until: austDay});
$('.countdown2').countdown({labels: ['Years', 'Months', 'Weeks', 'Days', 'Hrs', 'Min', 'Sec'], until: austDay, format: 'HMS'});
});
&#13;
<link rel="stylesheet" type="text/css" href="http://keith-wood.name/css/jquery.countdown.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript" src="http://keith-wood.name/js/jquery.plugin.js"></script>
<script type="text/javascript" src="http://keith-wood.name/js/jquery.countdown.js"></script>
Countdown1:
<div class="countdown1"></div><br/><br/><br/>
Countdown2:
<div class="countdown2"></div>
&#13;