File size: 1,652 Bytes
3f268e5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# jQuery.counter (javascript + css3)
Info + Demo: http://sophilabs.github.com/jquery-counter
![jQuery Counter](http://i.imgur.com/ub7D9.png)
A jQuery counter based on http://code.google.com/p/jquery-countdown with more options.
## Options
Options can be set by attribute `data-<name>="value"` or in the options hash on counter initialization: `$(element).counter({name: value, ...})`
**`direction: up|down`** Counter direction
**`format: string`** Defines the format and the limit for each part - _e.g: 23:59:59_
**`interval: number`** Defines the time between each counter increment - _by default 1000 milliseconds_
**`stop: string`** Defines the counter limit - _eg: 10:00 (ten minutes)_
## Methods
Methods can be call using `$(element).counter('method')`
**`play`** Play counter
**`reset`** Reset counter
**`stop`** Stop counter
## Events
**`counterStop`** Raised when the counter reach limit
## Example
### 10 seconds countdown:
<span class="counter counter-analog">0:10</span>
<script>
$('.counter').counter();
</script>
### 120 seconds count:
<span class="counter counter-analog" data-direction="up" data-format="120">0</span>
<script>
$('.counter').counter();
</script>
## License
jQuery.counter is Copyright (c) 2017 sophilabs, inc. It is free software, and may be
redistributed under the terms specified in the [license](/LICENSE) file.
## About
[![sophilabs.co](https://s3.amazonaws.com/sophilabs-assets/logo/logo_300x66.gif)](https://sophilabs.co)
jQuery.counter is maintained and funded by sophilabs, inc. The names and logos for
sophilabs are trademarks of sophilabs, inc.
|