zoukankan      html  css  js  c++  java
  • 倒计时

    html

    <p class="time" id="countdown">
    <span id="days"></span><b>天</b><span id="hours"></span><b>小时</b><span id="minutes"></span><b>分钟</b><span id="seconds"></span><b>秒</b>
    </p>

    js

    <script src="__TMPL__Mobile/js/jquery.countdown.min.js"></script>
    <script type="text/javascript">

    $(function(){
    // 倒计时------
    /* Counter */
    var finished = false;
    var countNum = $('#countNum').html();
    // alert(countNum);
    console.log(countNum);

    // 时间格式:2017/02/08 20:50:00
    var toDate = new Date(countNum); // Counter end date/time.

    function callback(event) {
    $this = $(this);
    switch(event.type) {
    case "seconds":
    case "minutes":
    case "hours":
    case "days":
    case "weeks":
    case "daysLeft":
    $this.find('span#'+event.type).html(event.value);
    if(finished) {
    $this.fadeTo(0, 1);
    finished = false;
    }
    break;
    case "finished":
    $this.fadeTo('slow', .8);
    finished = true;
    break;
    }
    }
    $('#countdown').countdown(toDate, callback);
    });

  • 相关阅读:
    Poj-1088-滑雪
    Poj-2250-Compromise
    CF
    KMP算法
    01背包
    NY 269 VF
    PHP--1+2+3……100=?
    PHP企业发放的奖金--if...elseif...
    2019年中级考试题(附答案)
    PHP的IF条件语句-- 输入一个数字进行判断等级
  • 原文地址:https://www.cnblogs.com/yzadd/p/6473988.html
Copyright © 2011-2022 走看看