Skip to content

Commit 9b5fb11

Browse files
committed
Updated build
1 parent b23c1de commit 9b5fb11

17 files changed

+4795
-10125
lines changed

dist/smooth-scroll.js

100755100644
Lines changed: 11 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,9 @@
1-
/*!
2-
* smooth-scroll v16.1.4
3-
* Animate scrolling to anchor links
4-
* (c) 2020 Chris Ferdinandi
5-
* MIT License
6-
* http://github.com/cferdinandi/smooth-scroll
7-
*/
8-
9-
(function (root, factory) {
10-
if (typeof define === 'function' && define.amd) {
11-
define([], (function () {
12-
return factory(root);
13-
}));
14-
} else if (typeof exports === 'object') {
15-
module.exports = factory(root);
16-
} else {
17-
root.SmoothScroll = factory(root);
18-
}
19-
})(typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : this, (function (window) {
20-
21-
'use strict';
1+
/*! SmoothScroll v16.1.4 | (c) 2020 Chris Ferdinandi | MIT License | http://github.com/cferdinandi/smooth-scroll */
2+
(function (global, factory) {
3+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
4+
typeof define === 'function' && define.amd ? define(factory) :
5+
(global = global || self, global.SmoothScroll = factory());
6+
}(this, (function () { 'use strict';
227

238
//
249
// Default settings
@@ -77,12 +62,12 @@
7762
*/
7863
var extend = function () {
7964
var merged = {};
80-
Array.prototype.forEach.call(arguments, (function (obj) {
65+
Array.prototype.forEach.call(arguments, function (obj) {
8166
for (var key in obj) {
8267
if (!obj.hasOwnProperty(key)) return;
8368
merged[key] = obj[key];
8469
}
85-
}));
70+
});
8671
return merged;
8772
};
8873

@@ -249,7 +234,7 @@
249234
if (clip) {
250235
location = Math.min(location, getDocumentHeight() - window.innerHeight);
251236
}
252-
return location;
237+
return location;
253238
};
254239

255240
/**
@@ -379,7 +364,7 @@
379364
//
380365

381366
var smoothScroll = {}; // Object for public APIs
382-
var settings, anchor, toggle, fixedHeader, eventTimeout, animationInterval;
367+
var settings, toggle, fixedHeader, animationInterval;
383368

384369

385370
//
@@ -591,10 +576,8 @@
591576

592577
// Reset variables
593578
settings = null;
594-
anchor = null;
595579
toggle = null;
596580
fixedHeader = null;
597-
eventTimeout = null;
598581
animationInterval = null;
599582

600583
};
@@ -643,4 +626,4 @@
643626

644627
return SmoothScroll;
645628

646-
}));
629+
})));

dist/smooth-scroll.min.js

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

dist/smooth-scroll.polyfills.js

100755100644
Lines changed: 75 additions & 91 deletions
Original file line numberDiff line numberDiff line change
@@ -1,94 +1,80 @@
1-
/*!
2-
* smooth-scroll v16.1.4
3-
* Animate scrolling to anchor links
4-
* (c) 2020 Chris Ferdinandi
5-
* MIT License
6-
* http://github.com/cferdinandi/smooth-scroll
7-
*/
8-
9-
/**
10-
* closest() polyfill
11-
* @link https://developer.mozilla.org/en-US/docs/Web/API/Element/closest#Polyfill
12-
*/
13-
if (window.Element && !Element.prototype.closest) {
14-
Element.prototype.closest = function(s) {
15-
var matches = (this.document || this.ownerDocument).querySelectorAll(s),
16-
i,
17-
el = this;
18-
do {
19-
i = matches.length;
20-
while (--i >= 0 && matches.item(i) !== el) {}
21-
} while ((i < 0) && (el = el.parentElement));
22-
return el;
23-
};
24-
}
1+
/*! SmoothScroll v16.1.4 | (c) 2020 Chris Ferdinandi | MIT License | http://github.com/cferdinandi/smooth-scroll */
2+
(function (global, factory) {
3+
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
4+
typeof define === 'function' && define.amd ? define(factory) :
5+
(global = global || self, global.SmoothScroll = factory());
6+
}(this, (function () { 'use strict';
257

26-
/**
27-
* CustomEvent() polyfill
28-
* https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#Polyfill
29-
*/
30-
(function () {
8+
/**
9+
* closest() polyfill
10+
* @link https://developer.mozilla.org/en-US/docs/Web/API/Element/closest#Polyfill
11+
*/
12+
if (window.Element && !Element.prototype.closest) {
13+
Element.prototype.closest = function(s) {
14+
var matches = (this.document || this.ownerDocument).querySelectorAll(s),
15+
i,
16+
el = this;
17+
do {
18+
i = matches.length;
19+
while (--i >= 0 && matches.item(i) !== el) {}
20+
} while ((i < 0) && (el = el.parentElement));
21+
return el;
22+
};
23+
}
3124

32-
if (typeof window.CustomEvent === "function") return false;
25+
/**
26+
* CustomEvent() polyfill
27+
* https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#Polyfill
28+
*/
29+
(function () {
3330

34-
function CustomEvent(event, params) {
35-
params = params || { bubbles: false, cancelable: false, detail: undefined };
36-
var evt = document.createEvent('CustomEvent');
37-
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
38-
return evt;
39-
}
31+
if (typeof window.CustomEvent === "function") return false;
4032

41-
CustomEvent.prototype = window.Event.prototype;
42-
43-
window.CustomEvent = CustomEvent;
44-
})();
45-
/**
46-
* requestAnimationFrame() polyfill
47-
* By Erik Möller. Fixes from Paul Irish and Tino Zijdel.
48-
* @link http://paulirish.com/2011/requestanimationframe-for-smart-animating/
49-
* @link http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
50-
* @license MIT
51-
*/
52-
(function() {
53-
var lastTime = 0;
54-
var vendors = ['ms', 'moz', 'webkit', 'o'];
55-
for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
56-
window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame'];
57-
window.cancelAnimationFrame = window[vendors[x]+'CancelAnimationFrame'] ||
58-
window[vendors[x]+'CancelRequestAnimationFrame'];
59-
}
33+
function CustomEvent(event, params) {
34+
params = params || { bubbles: false, cancelable: false, detail: undefined };
35+
var evt = document.createEvent('CustomEvent');
36+
evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);
37+
return evt;
38+
}
6039

61-
if (!window.requestAnimationFrame) {
62-
window.requestAnimationFrame = function(callback, element) {
63-
var currTime = new Date().getTime();
64-
var timeToCall = Math.max(0, 16 - (currTime - lastTime));
65-
var id = window.setTimeout((function() { callback(currTime + timeToCall); }),
66-
timeToCall);
67-
lastTime = currTime + timeToCall;
68-
return id;
69-
};
70-
}
40+
CustomEvent.prototype = window.Event.prototype;
7141

72-
if (!window.cancelAnimationFrame) {
73-
window.cancelAnimationFrame = function(id) {
74-
clearTimeout(id);
75-
};
76-
}
77-
}());
78-
79-
(function (root, factory) {
80-
if (typeof define === 'function' && define.amd) {
81-
define([], (function () {
82-
return factory(root);
83-
}));
84-
} else if (typeof exports === 'object') {
85-
module.exports = factory(root);
86-
} else {
87-
root.SmoothScroll = factory(root);
88-
}
89-
})(typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : this, (function (window) {
42+
window.CustomEvent = CustomEvent;
43+
})();
9044

91-
'use strict';
45+
/**
46+
* requestAnimationFrame() polyfill
47+
* By Erik Möller. Fixes from Paul Irish and Tino Zijdel.
48+
* @link http://paulirish.com/2011/requestanimationframe-for-smart-animating/
49+
* @link http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
50+
* @license MIT
51+
*/
52+
(function() {
53+
var lastTime = 0;
54+
var vendors = ['ms', 'moz', 'webkit', 'o'];
55+
for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
56+
window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame'];
57+
window.cancelAnimationFrame = window[vendors[x]+'CancelAnimationFrame'] ||
58+
window[vendors[x]+'CancelRequestAnimationFrame'];
59+
}
60+
61+
if (!window.requestAnimationFrame) {
62+
window.requestAnimationFrame = function(callback, element) {
63+
var currTime = new Date().getTime();
64+
var timeToCall = Math.max(0, 16 - (currTime - lastTime));
65+
var id = window.setTimeout(function() { callback(currTime + timeToCall); },
66+
timeToCall);
67+
lastTime = currTime + timeToCall;
68+
return id;
69+
};
70+
}
71+
72+
if (!window.cancelAnimationFrame) {
73+
window.cancelAnimationFrame = function(id) {
74+
clearTimeout(id);
75+
};
76+
}
77+
}());
9278

9379
//
9480
// Default settings
@@ -147,12 +133,12 @@ if (window.Element && !Element.prototype.closest) {
147133
*/
148134
var extend = function () {
149135
var merged = {};
150-
Array.prototype.forEach.call(arguments, (function (obj) {
136+
Array.prototype.forEach.call(arguments, function (obj) {
151137
for (var key in obj) {
152138
if (!obj.hasOwnProperty(key)) return;
153139
merged[key] = obj[key];
154140
}
155-
}));
141+
});
156142
return merged;
157143
};
158144

@@ -319,7 +305,7 @@ if (window.Element && !Element.prototype.closest) {
319305
if (clip) {
320306
location = Math.min(location, getDocumentHeight() - window.innerHeight);
321307
}
322-
return location;
308+
return location;
323309
};
324310

325311
/**
@@ -449,7 +435,7 @@ if (window.Element && !Element.prototype.closest) {
449435
//
450436

451437
var smoothScroll = {}; // Object for public APIs
452-
var settings, anchor, toggle, fixedHeader, eventTimeout, animationInterval;
438+
var settings, toggle, fixedHeader, animationInterval;
453439

454440

455441
//
@@ -661,10 +647,8 @@ if (window.Element && !Element.prototype.closest) {
661647

662648
// Reset variables
663649
settings = null;
664-
anchor = null;
665650
toggle = null;
666651
fixedHeader = null;
667-
eventTimeout = null;
668652
animationInterval = null;
669653

670654
};
@@ -713,4 +697,4 @@ if (window.Element && !Element.prototype.closest) {
713697

714698
return SmoothScroll;
715699

716-
}));
700+
})));

0 commit comments

Comments
 (0)