{"_id":"jquery-countto","_rev":"6-6a14aed9f43f46c0dd945b800e5fb2ed","name":"jquery-countto","description":"A jQuery plugin that will count up (or down) to a target number at a specified speed.","dist-tags":{"latest":"1.2.0"},"versions":{"1.0.0":{"name":"jquery-countto","version":"1.0.0","description":"jQuery countTo Plugin ===================== [jQuery countTo](https://github.com/mhuggins/jquery-countTo) is a [jQuery](http://jquery.com) plugin that will count up (or down) to a target number at a specified speed, rendered within an HTML DOM element.","main":"jquery.countTo.js","directories":{"test":"test"},"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/mhuggins/jquery-countTo.git"},"author":{"name":"mhuggins"},"license":"MIT","bugs":{"url":"https://github.com/mhuggins/jquery-countTo/issues"},"homepage":"https://github.com/mhuggins/jquery-countTo#readme","gitHead":"86e2a63d849388843b2c16e16f89e14b90da5506","_id":"jquery-countto@1.0.0","_shasum":"a2f03f9d90f32061d91c57c6135d1064a76a0b6e","_from":".","_npmVersion":"2.11.2","_nodeVersion":"0.12.6","_npmUser":{"name":"imsky","email":"hello@imsky.co"},"dist":{"shasum":"a2f03f9d90f32061d91c57c6135d1064a76a0b6e","tarball":"https://registry.npmjs.org/jquery-countto/-/jquery-countto-1.0.0.tgz","integrity":"sha512-7cIAseiUVQ+CxbYiltFOO8ymfzi/w0nZINGzKvIQ1ST26eGK+75ukFfy93QBVmBg7DUda0Ue/NAsIadHDtnyCw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCP5/Mke7190ZkFfp8J/qTbZD9vzwW5iC1lKLbIigJRMQIhALJjvsI4U3vvVpuQuQsJbsc5JBYX1/CAHUtAHF1nLvL3"}]},"maintainers":[{"name":"imsky","email":"hello@imsky.co"}]},"1.2.0":{"name":"jquery-countto","version":"1.2.0","description":"A jQuery plugin that will count up (or down) to a target number at a specified speed.","main":"jquery.countTo.js","directories":{"test":"test"},"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"repository":{"type":"git","url":"git+https://github.com/mhuggins/jquery-countTo.git"},"keywords":["jQuery","counter","count","increment","decrement"],"author":{"name":"Matt Huggins","email":"matt.huggins@gmail.com"},"license":"MIT","bugs":{"url":"https://github.com/mhuggins/jquery-countTo/issues"},"homepage":"https://github.com/mhuggins/jquery-countTo#readme","gitHead":"636f1fca33abd40e2f29048df82b2dc9f1013cca","_id":"jquery-countto@1.2.0","_shasum":"49f17fcb24a746a168b84321e50e9b7751819660","_from":".","_npmVersion":"3.8.6","_nodeVersion":"5.11.0","_npmUser":{"name":"mhuggins","email":"matt.huggins@gmail.com"},"dist":{"shasum":"49f17fcb24a746a168b84321e50e9b7751819660","tarball":"https://registry.npmjs.org/jquery-countto/-/jquery-countto-1.2.0.tgz","integrity":"sha512-oj6XloU4b8VHcXqFwZ3OybnOKm+qBA8KElj1a2YhXvIJyBXn8lw9d9gyffcZ1eYMZAyZ9cPuSU1gzB9TPMMi5A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGdISWlhlphdGZXyyaYkxhnQLxH9UL8kuxfYeIpkJxEaAiAyQMbrWl0M4w85GIGY8y+8yYGv00wcSirvoMg85+jhKA=="}]},"maintainers":[{"name":"imsky","email":"hello@imsky.co"},{"name":"mhuggins","email":"matt.huggins@gmail.com"}],"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/jquery-countto-1.2.0.tgz_1464465701444_0.4509265716187656"}}},"readme":"jQuery countTo Plugin\n=====================\n[jQuery countTo](https://github.com/mhuggins/jquery-countTo) is a\n[jQuery](http://jquery.com) plugin that will count up (or down) to a target\nnumber at a specified speed, rendered within an HTML DOM element.\n\nRequirements:\n-------------\n[jQuery countTo](https://github.com/mhuggins/jquery-countTo) requires the\nlatest version of [jQuery](http://jquery.com).\n\nUsage:\n------\nThere are two main approaches to using this plugin: through data attributes on\nDOM nodes, and through JS options explicitly passed to the `countTo` function.\n\nThese two methods can be mixed and matched as well.  Data attributes takes\nprecedence over JS options.\n\n### Data Attributes\n\nThis approach allows you to define `data-*` attributes on whatever DOM element\nwill act as a container for your counter.  This is useful when you already know\nthe values at the time that you are constructing the DOM.\n\n    <span class=\"timer\" data-from=\"25\" data-to=\"75\"></span>\n    \n    <script type=\"text/javascript\">\n      $('.timer').countTo();\n    </script>\n\nA more detailed example that demonstrates all possible options being used is as\nfollows.\n\n    <span class=\"timer\" data-from=\"0\" data-to=\"100\"\n          data-speed=\"5000\" data-refresh-interval=\"50\"></span>\n    \n    <script type=\"text/javascript\">\n      $('.timer').countTo();\n    </script>\n\nRefer to the **Options** section below for more info on the various options\navailable.\n\n### JavaScript Options\n\nThis approach allows you to pass values to the `countTo` function.  This is\nuseful when you don't know the values at the time the DOM is being rendered.\n\n    <span class=\"timer\"></span>\n    \n    <script type=\"text/javascript\">\n      $('.timer').countTo({from: 0, to: 500});\n    </script>\n\nA more detailed example that demonstrates all possible options being used is as\nfollows.\n\n    <span class=\"timer\"></span>\n    \n    <script type=\"text/javascript\">\n      $('.timer').countTo({\n        from: 50,\n        to: 2500,\n        speed: 1000,\n        refreshInterval: 50,\n        formatter: function (value, options) {\n          return value.toFixed(options.decimals);\n        },\n        onUpdate: function (value) {\n          console.debug(this);\n        },\n        onComplete: function (value) {\n          console.debug(this);\n        }\n      });\n    </script>\n\nRefer to the **Options** section below for more info on the various options\navailable.\n\nOptions:\n--------\nA complete listing of the options that can be passed to the `countTo` method is\nbelow.\n\n<table>\n  <tr>\n    <th>Option</th>\n    <th>Data Attribute</th>\n    <th>Description</th>\n  </tr>\n  <tr>\n    <td><i>from</i></td>\n    <td><i>data-from</i></td>\n    <td>The number to start counting from. <i>(default: 0)</i></td>\n  </tr>\n  <tr>\n    <td><i>to</i></td>\n    <td><i>data-to</i></td>\n    <td>The number to stop counting at. <i>(default: 100)</i></td>\n  </tr>\n  <tr>\n    <td><i>speed</i></td>\n    <td><i>data-speed</i></td>\n    <td>The number of milliseconds it should take to finish counting.\n        <i>(default: 1000)</i></td>\n  </tr>\n  <tr>\n    <td><i>refreshInterval</i></td>\n    <td><i>data-refresh-interval</i></td>\n    <td>The number of milliseconds to wait between refreshing the counter.\n        <i>(default: 100)</i></td>\n  </tr>\n  <tr>\n    <td colspan=\"2\"><i>formatter (value, options)</i></td>\n    <td>A handler that is used to format the current value before rendering to\n        the DOM.  The true current value and options set is passed to the\n        function, and it is run in the context of the DOM element.  It must\n        return the formatted value. <i>(default:\n        <code>value.toFixed(options.decimal)</code>)</i></td>\n  </tr>\n  <tr>\n    <td colspan=\"2\"><i>onUpdate (value)</i></td>\n    <td>A callback function that is triggered for every iteration that the\n        counter updates.  The currently rendered value is passed to the\n        function, and it is called in the context of the DOM element.\n        <i>(default: null)</i></td>\n  </tr>\n  <tr>\n    <td colspan=\"2\"><i>onComplete (value)</i></td>\n    <td>A callback function that is triggered when counting finishes.  The\n        final rendered value is passed to the function, and it is called in the\n        context of the DOM element. <i>(default: null)</i></td>\n  </tr>\n</table>\n\nFunctions:\n----------\nThis plugin also supports functions, primarily for changing state.  Functions are\ncalled by passing the name as a string to the `countTo` jQuery function, e.g.:\n`$('#timer').countTo('stop')`.\n\n<table>\n  <tr>\n    <td><i>start</i></td>\n    <td>Resumes the timer if it is stopped.</td>\n  </tr>\n  <tr>\n    <td><i>stop</i></td>\n    <td>Stops (pauses) the timer if it is running.</td>\n  </tr>\n  <tr>\n    <td><i>toggle</i></td>\n    <td>Starts or stops the timer based upon its current state.</td>\n  </tr>\n  <tr>\n    <td><i>restart</i></td>\n    <td>Restarts the timer at its initial \"from\" value.</td>\n  </tr>\n</table>\n\nCreated By:\n-----------\n[Matt Huggins](http://matthuggins.com)\n\nLicense:\n--------\njQuery-countTo is released under the\n[MIT license](http://www.opensource.org/licenses/MIT).\n","maintainers":[{"email":"matt.huggins@gmail.com","name":"mhuggins"}],"time":{"modified":"2022-06-19T05:00:48.266Z","created":"2015-07-04T16:34:51.442Z","1.0.0":"2015-07-04T16:34:51.442Z","1.2.0":"2016-05-28T20:01:43.882Z"},"homepage":"https://github.com/mhuggins/jquery-countTo#readme","repository":{"type":"git","url":"git+https://github.com/mhuggins/jquery-countTo.git"},"author":{"name":"Matt Huggins","email":"matt.huggins@gmail.com"},"bugs":{"url":"https://github.com/mhuggins/jquery-countTo/issues"},"license":"MIT","readmeFilename":"readme.md","keywords":["jQuery","counter","count","increment","decrement"]}