Code Monkey home page Code Monkey logo

countdown's Introduction

countDown

jquery封装的倒计时插件 倒计时的效果是项目中经常用到的,这款倒计时插件是我根据实际项目中的需求自己封装的,以下请见使用说明

使用说明

首先引入两个js文件,一是jquery-1.11.1.min.js,另一个是我自己封装的jquery.Countdown.js

<script type="text/javascript" src="js/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="js/jquery.Countdown.js"></script>

html基本布局如下:

<!-- 倒计时 start -->
<div class="try_countdown clearfix">
    <div class="try_fl">剩余时间:</div>
    <div id="countdown_dashboard">
        <div class="dash days_dash">                            
            <div class="digit"></div>
            <div class="digit"></div>
            <span class="dash_title"></span>
        </div>
        <div class="dash hours_dash">                            
            <div class="digit"></div>
            <div class="digit"></div>
            <span class="dash_title"></span>
        </div>

        <div class="dash minutes_dash">                            
            <div class="digit"></div>
            <div class="digit"></div>
            <span class="dash_title"></span>
        </div>
        <div class="dash seconds_dash">                            
            <div class="digit"></div>
            <div class="digit"></div>
            <span class="dash_title"></span>
        </div>
    </div>
</div>
<!-- 倒计时 end -->

使用及配置选项

$(function(){
    // 倒计时
    $('#countdown_dashboard').countDown({
        targetDate: {  //目标时间
            'day':      12,   //日
            'month':    5,    //月
            'year':     2017, //年
            'hour':     0,    //时
            'min':      0,    //分
            'sec':      0     //秒                 
        },
        //serverTime: time_server_Date,  //服务器时间
        onComplete: function(){  //倒计时完成后
            alert("倒计时完成");
        }
    });
})

调用$('#countdown_dashboard').stopCountDown();可以停止倒计时

调用$('#countdown_dashboard').startCountDown();可以开始倒计时

countdown's People

Contributors

floweringvivian avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.