Skip to content
This repository has been archived by the owner on Aug 22, 2021. It is now read-only.

Counterup support for waypoint v3+ #46

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Usage
**Include**

```
<script src="http://cdnjs.cloudflare.com/ajax/libs/waypoints/2.0.3/waypoints.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/waypoints/4.0.1/jquery.waypoints.min.js"></script>
<script src="jquery.counterup.min.js"></script>
```

Expand Down
4 changes: 2 additions & 2 deletions counterup.jquery.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "counterup",
"version": "1.0.0",
"version": "1.0.1",
"title": "Counter-Up",
"description": "A lightweight jQuery plugin that counts up to a targeted number when the number becomes visible.",
"keywords": [
Expand Down Expand Up @@ -33,4 +33,4 @@
"waypoints": ">=2.0"
},
"demo": "http://bfintal.github.io/Counter-Up/demo/demo.html"
}
}
4 changes: 2 additions & 2 deletions demo/demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ <h3>(Scroll down)</h3>
&lt;body><br>
<span style="color: #f1c40f">
&nbsp; &nbsp; &lt;span class="counter">1,234,567&lt;/span><br>
&nbsp; &nbsp; &lt;script src="//cdnjs.cloudflare.com/ajax/libs/waypoints/2.0.3/waypoints.min.js">&lt;/script><br>
&nbsp; &nbsp; &lt;script src="//cdnjs.cloudflare.com/ajax/libs/waypoints/4.0.1/jquery.waypoints.min.js">&lt;/script><br>
&nbsp; &nbsp; &lt;script src="jquery.counterup.min.js">&lt;/script><br>
</span>
&lt;/body>
Expand Down Expand Up @@ -154,7 +154,7 @@ <h3>(Scroll down)</h3>
<span class="counter" style="display: inline-block; width: 32%">958393.10</span>
<span class="counter" style="display: inline-block; width: 32%">5,123,348</span>
</div>
<script src="http://cdnjs.cloudflare.com/ajax/libs/waypoints/2.0.3/waypoints.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/waypoints/4.0.1/jquery.waypoints.min.js"></script>
<script src="../jquery.counterup.min.js"></script>
</body>
</html>
7 changes: 5 additions & 2 deletions jquery.counterup.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,15 @@

// Start the count up
setTimeout($this.data('counterup-func'), $settings.delay);

// Destroy waypoint so that it will be triggered only once
this.destroy();
};

// Perform counts when the element gets into view
$this.waypoint(counterUpper, { offset: '100%', triggerOnce: true });
$this.waypoint(counterUpper, { offset: '100%' });
});

};

})( jQuery );
})( jQuery );
2 changes: 1 addition & 1 deletion jquery.counterup.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.