• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

robcowie/jquery-stopwatch: A jQuery plugin that renders a count-up clock from a ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

robcowie/jquery-stopwatch

开源软件地址:

https://github.com/robcowie/jquery-stopwatch

开源编程语言:

JavaScript 88.5%

开源软件介绍:

Simple count-up jQuery plugin

Summary

A jQuery plugin that renders a count-up clock from a defined start time. Supports start, stop, toggle, reset, and custom 'tick' event.

Usage

  • Initialise and start a default timer
$('').stopwatch().stopwatch('start')
  • Initialise and bind start/stop to click
$('').stopwatch().click(function(){
    $(this).stopwatch('toggle')
})
  • Bind to tick event and reset when 10 seconds has elapsed
$('').stopwatch().bind('tick.stopwatch', function(e, elapsed){
    if (elapsed >= 10000) {
        $(this).stopwatch('reset');
    }
}).stopwatch('start')
  • Start at non-zero elapsed time
$('').stopwatch({startTime: 10000000}).stopwatch('start')

Formatting

Provided by the jintervals lib. If you don't include this library, the default output format HH:MM:SS is used.

Formats

Pass a format pattern as the format option. jsintervals provides a rich syntax for formatting time intervals, perhaps best illustrated by some examples.

'{MM}:{ss}' --> 01:05
'{MMM}:{ss}' --> 001:05
'{M}m, {s}s' --> 1m, 5s
'{Minutes} and {seconds}' --> 1 minute and 5 seconds
'{Greatest} ago' --> 1 minute ago

The full documentation of the syntax is at http://code.google.com/p/jintervals/wiki/Documentation.

Custom formatter

A formatter function can be supplied as formatter in options. It receives milliseconds and options and must return a string.

Licence

Copyright (c) 2012 Rob Cowie. Licensed under the MIT license.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap