Skip to content

Commit

Permalink
Remove extraneous parseFloat arguments, and add float count example
Browse files Browse the repository at this point in the history
  • Loading branch information
mhuggins committed Jan 31, 2013
1 parent 977fdaa commit b6c9a21
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions example.html
Expand Up @@ -57,13 +57,18 @@ <h2>Start the countdown...</h2>
<p>Lift-off in <b id="countdown" data-from="3" data-to="1" data-speed="3000"></b></p>
</div>

<div class="example">
<h2>Earth's Gravity</h2>
<p><b id="gravity" data-from="0.0" data-to="9.8" data-speed="3000" data-decimals="2"></b> m/s<sup>2</sup></p>
</div>

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript" src="jquery.countTo.js"></script>

<script type="text/javascript">
jQuery(function ($) {
// simple example
$('#lollipop').countTo();
// simple examples
$('#lollipop, #gravity').countTo();

// custom formatting example
$('#earth').countTo({
Expand Down
4 changes: 2 additions & 2 deletions jquery.countTo.js
Expand Up @@ -6,8 +6,8 @@
return $(this).each(function () {
// set options for current element
var settings = $.extend({}, options, {
from: parseFloat($(this).attr('data-from') || options.from, 10),
to: parseFloat($(this).attr('data-to') || options.to, 10),
from: parseFloat($(this).attr('data-from') || options.from),
to: parseFloat($(this).attr('data-to') || options.to),
speed: parseInt($(this).attr('data-speed') || options.speed, 10),
refreshInterval: parseInt($(this).attr('data-refresh-interval') || options.refreshInterval, 10),
decimals: parseInt($(this).attr('data-decimals') || options.decimals, 10)
Expand Down

0 comments on commit b6c9a21

Please sign in to comment.