Skip to content

Commit c623142

Browse files
committed
Bump version for #285, improve README
1 parent e24cc69 commit c623142

File tree

7 files changed

+12
-9
lines changed

7 files changed

+12
-9
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ CountUp.js supports all browsers. MIT license.
77

88
## [Try the demo](https://inorganik.github.io/countUp.js)
99

10+
Or tinker with CountUp in [Stackblitz](https://stackblitz.com/edit/countup-typescript)
1011

1112
## Jump to:
1213

@@ -34,7 +35,7 @@ CountUp.js supports all browsers. MIT license.
3435

3536
## Usage:
3637

37-
**On npm**: `countup.js`
38+
**On npm** as: `countup.js`. You can import as a module or include the UMD script and access CountUp as a global. See [detailed instructions](#including-countup) below.
3839

3940
**Params**:
4041
- `target: string | HTMLElement | HTMLInputElement` - id of html element, input, svg text element, or DOM element reference where counting occurs

dist/countUp.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ var CountUp = /** @class */ (function () {
1515
var _this = this;
1616
this.endVal = endVal;
1717
this.options = options;
18-
this.version = '2.2.0';
18+
this.version = '2.3.0';
1919
this.defaults = {
2020
startVal: 0,
2121
decimalPlaces: 0,
@@ -158,7 +158,8 @@ var CountUp = /** @class */ (function () {
158158
if (!self || !window || self.once)
159159
return;
160160
var bottomOfScroll = window.innerHeight + window.scrollY;
161-
var bottomOfEl = self.el.offsetTop + self.el.offsetHeight;
161+
var rect = self.el.getBoundingClientRect();
162+
var bottomOfEl = rect.top + rect.height + window.pageYOffset;
162163
if (bottomOfEl < bottomOfScroll && bottomOfEl > window.scrollY && self.paused) {
163164
// in view
164165
self.paused = false;

dist/countUp.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/countUp.umd.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
var _this = this;
2222
this.endVal = endVal;
2323
this.options = options;
24-
this.version = '2.2.0';
24+
this.version = '2.3.0';
2525
this.defaults = {
2626
startVal: 0,
2727
decimalPlaces: 0,
@@ -164,7 +164,8 @@
164164
if (!self || !window || self.once)
165165
return;
166166
var bottomOfScroll = window.innerHeight + window.scrollY;
167-
var bottomOfEl = self.el.offsetTop + self.el.offsetHeight;
167+
var rect = self.el.getBoundingClientRect();
168+
var bottomOfEl = rect.top + rect.height + window.pageYOffset;
168169
if (bottomOfEl < bottomOfScroll && bottomOfEl > window.scrollY && self.paused) {
169170
// in view
170171
self.paused = false;

0 commit comments

Comments
 (0)