Skip to content

Commit fe751e4

Browse files
committed
chore: update build
1 parent 02bede5 commit fe751e4

File tree

2 files changed

+21
-12
lines changed

2 files changed

+21
-12
lines changed

dist/AnimatedScroll.js

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
/**
22
* animated-scroll
3-
* Version: 0.0.1
4-
* (c) 2016 Joel Mukuthu
3+
* Version: 0.0.2
4+
* (c) 2019 Joel Mukuthu
55
* MIT License
6-
* Built on: 17-11-2016 18:05:38 GMT+0100
6+
* Built on: 07-12-2019 12:49:33 GMT+0100
77
**/
88

99
(function (global, factory) {
@@ -105,10 +105,10 @@
105105

106106
var validatePositiveNumber = function validatePositiveNumber(number, name) {
107107
if (typeof number !== 'number' || isNaN(number)) {
108-
throw new Error(name + ' (' + number + ') should be a number');
108+
throw new Error(name + ' should be a number');
109109
}
110110
if (number < 0) {
111-
throw new Error(name + ' (' + number + ') should be greater than zero');
111+
throw new Error(name + ' should be greater than or equal to zero');
112112
}
113113
};
114114

@@ -118,6 +118,10 @@
118118

119119
_classCallCheck(this, AnimatedScroll);
120120

121+
if (!element) {
122+
throw new Error('provide a DOM element');
123+
}
124+
121125
if ((typeof element === 'undefined' ? 'undefined' : _typeof(element)) !== 'object' || typeof element.nodeName !== 'string') {
122126
throw new Error('the element should be a DOM element');
123127
}
@@ -141,8 +145,11 @@
141145
}
142146

143147
var easing = options.easing;
144-
if (typeof easing !== 'undefined' && typeof easing !== 'function') {
145-
throw new Error('the easing option should be a function');
148+
if (typeof easing !== 'undefined') {
149+
if (typeof easing !== 'function') {
150+
throw new Error('the easing option should be a function');
151+
}
152+
this.easing = easing;
146153
} else {
147154
this.easing = easeInOutQuad;
148155
}
@@ -160,7 +167,7 @@
160167
validatePositiveNumber(offset, direction);
161168

162169
if (duration !== false) {
163-
return validatePositiveNumber(duration, 'duration');
170+
validatePositiveNumber(duration, 'duration');
164171
}
165172
if (typeof easing !== 'function') {
166173
throw new Error('easing should be a function');
@@ -175,7 +182,7 @@
175182
_this.stopTop();
176183
} else {
177184
elementProperty = 'scrollLeft';
178-
animationProperty = 'topAnimation';
185+
animationProperty = 'leftAnimation';
179186

180187
_this.stopLeft();
181188
}
@@ -191,7 +198,8 @@
191198
var change = offset - start;
192199
var timeIncrement = _this.timeIncrement;
193200

194-
duration = parseInt(duration);
201+
duration = parseInt(duration, 10); // you want to use radix 10
202+
// so you get a decimal number even with a leading 0 and an old browser ([IE8, Firefox 20, Chrome 22 and older][1])
195203

196204
var currentTime = 0;
197205
var animate = function animate() {
@@ -214,6 +222,7 @@
214222
resolve(_this.element[elementProperty]);
215223
}
216224
};
225+
animate();
217226
});
218227
}
219228
}, {

dist/AnimatedScroll.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)