Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sweet-scroll

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sweet-scroll - npm Package Compare versions

Comparing version 1.0.4 to 1.1.0

README.md

11

CHANGELOG.md

@@ -0,1 +1,12 @@

## 1.1.0
* Add `searchContainerTimeout` options
- We changed the find logic of container element. Because there is a possibility of Timeout Along with it was to add this option.
* Add `outputLog` options
- In order to aid in debugging has been added the output of the warning log.
* Add `yarn.lock`
* Update devDependencies
* Fix some tests
## 1.0.4

@@ -2,0 +13,0 @@

45

package.json
{
"name": "sweet-scroll",
"version": "1.0.4",
"version": "1.1.0",
"description": "Modern and the sweet smooth scroll library.",

@@ -26,2 +26,4 @@ "main": "sweet-scroll.js",

"files": [
"src",
"test",
"sweet-scroll.js",

@@ -46,38 +48,33 @@ "sweet-scroll.min.js"

"devDependencies": {
"autoprefixer": "^6.4.0",
"babel-eslint": "^6.1.2",
"autoprefixer": "^6.5.1",
"babel-eslint": "^7.0.0",
"babel-plugin-espower": "^2.3.1",
"babel-preset-es2015": "^6.13.2",
"babel-preset-es2015": "^6.16.0",
"babel-preset-es2015-rollup": "^1.2.0",
"babel-preset-stage-0": "^6.5.0",
"babel-preset-stage-0": "^6.16.0",
"babelify": "^7.3.0",
"browser-sync": "^2.14.0",
"browser-sync": "^2.17.3",
"browserify": "^13.1.0",
"copyfiles": "^1.0.0",
"eslint": "^3.3.1",
"karma": "^1.2.0",
"eslint": "^3.8.1",
"karma": "^1.3.0",
"karma-browserify": "^5.1.0",
"karma-cli": "^1.0.1",
"karma-fixture": "^0.2.6",
"karma-html2js-preprocessor": "^1.0.0",
"karma-mocha": "^1.1.1",
"karma-phantomjs-launcher": "^1.0.1",
"karma-html2js-preprocessor": "^1.1.0",
"karma-mocha": "^1.2.0",
"karma-phantomjs-launcher": "^1.0.2",
"karma-phantomjs-shim": "^1.4.0",
"mocha": "^3.0.2",
"node-sass": "^3.8.0",
"onchange": "^2.5.0",
"phantomjs-prebuilt": "^2.1.12",
"postcss-cli": "^2.5.2",
"mocha": "^3.1.2",
"node-sass": "^3.10.1",
"onchange": "^3.0.2",
"phantomjs-prebuilt": "^2.1.13",
"postcss-cli": "^2.6.0",
"power-assert": "^1.4.1",
"rollup": "^0.34.10",
"rollup": "^0.36.3",
"rollup-plugin-babel": "^2.6.1",
"sinon": "^1.17.6",
"uglify-js": "^2.7.3",
"watchify": "^3.7.0"
},
"files": [
"src",
"test",
"sweet-scroll.js",
"sweet-scroll.min.js"
]
}
}

@@ -20,3 +20,3 @@ import { $$ } from "./selectors";

function getZoomLevel() {
const { outerWidth, innerWidth } = window;
const { outerWidth, innerWidth } = win;

@@ -23,0 +23,0 @@ return outerWidth ? outerWidth / innerWidth : 1;

@@ -0,1 +1,3 @@

import { win } from "./elements";
// @link https://github.com/Modernizr/Modernizr

@@ -14,3 +16,3 @@ export const history = (() => {

return (window.history && "pushState" in window.history && window.location.protocol !== "file:");
return (win.history && "pushState" in win.history && win.location.protocol !== "file:");
})();

@@ -7,2 +7,3 @@ import * as Util from "./utils";

import { addEvent, removeEvent } from "./events";
import { raf } from "./request-animation-frame";
import { win, doc } from "./elements";

@@ -25,9 +26,4 @@ import ScrollTween from "./scroll-tween";

const LOAD = "load";
let isDomContentLoaded = false;
addEvent(doc, DOM_CONTENT_LOADED, () => {
isDomContentLoaded = true;
});
class SweetScroll {

@@ -50,2 +46,4 @@

stopPropagation: true, // Prevents further propagation of the container element click event in the bubbling phase
searchContainerTimeout: 4000, // Specifies the maximum search time of Scrollabe Container
outputLog: false, // Specify level of output to log

@@ -60,3 +58,2 @@ // Callbacks

};
/* eslint-enable max-len */

@@ -71,8 +68,12 @@

constructor(options = {}, container = "body, html") {
const params = Util.merge({}, SweetScroll.defaults, options);
this.createAt = new Date();
this.options = Util.merge({}, SweetScroll.defaults, options);
this.options = params;
this.getContainer(container, target => {
if (target == null) {
this.log(`Not found scrollable container. => "${container}"`);
}
this.container = target;
this.header = $(params.header);
this.header = $(this.options.header);
this.tween = new ScrollTween(target);

@@ -82,3 +83,3 @@ this._trigger = null;

this.bindContainerClick();
this.hook(params, "initialized");
this.hook(this.options, "initialized");
});

@@ -88,2 +89,13 @@ }

/**
* Output log
* @param {String} message
* @return {void}
*/
log(message) {
if (this.options.outputLog) {
Util.warning(`[SweetScroll] ${message}`);
}
}
/**
* Scroll animation to the specified position

@@ -116,3 +128,5 @@ * @param {*} distance

// Does not move if the container is not found
if (!container) return;
if (!container) {
return this.log("Not found container element.");
}

@@ -136,3 +150,5 @@ // Using the coordinates in the case of CSS Selector

if (!scroll) return;
if (!scroll) {
return this.log(`Invalid parameter of distance. => ${distance}`);
}

@@ -174,3 +190,3 @@ // Apply `offset` value

// Update URL
if (hash != null && hash !== window.location.hash) {
if (hash != null && hash !== win.location.hash) {
this.updateURLHash(hash, params.updateURL);

@@ -240,2 +256,4 @@ }

this.to(offset, Util.merge({}, options));
} else {
this.log("Invalid parameter. in toElement()");
}

@@ -250,2 +268,6 @@ }

stop(gotoEnd = false) {
if (!this.container) {
this.log("Not found scrollable container.");
}
if (this._stopScrollListener) {

@@ -263,2 +285,6 @@ this._shouldCallCancelScroll = true;

update(options = {}) {
if (!this.container) {
this.log("Not found scrollable container.");
}
this.stop();

@@ -277,2 +303,6 @@ this.unbindContainerClick();

destroy() {
if (!this.container) {
this.log("Not found scrollable container.");
}
this.stop();

@@ -286,2 +316,3 @@ this.unbindContainerClick();

/* eslint-disable no-unused-vars */
/**

@@ -291,4 +322,3 @@ * Called at after of the initialize.

*/
initialized() {
}
initialized() {}

@@ -301,3 +331,2 @@ /**

*/
/* eslint-disable no-unused-vars */
beforeScroll(toScroll, trigger) {

@@ -307,4 +336,2 @@ return true;

/* eslint-enable no-unused-vars */
/**

@@ -314,4 +341,3 @@ * Called at cancel of the scroll.

*/
cancelScroll() {
}
cancelScroll() {}

@@ -324,8 +350,4 @@ /**

*/
/* eslint-disable no-unused-vars */
afterScroll(toScroll, trigger) {
}
afterScroll(toScroll, trigger) {}
/* eslint-enable no-unused-vars */
/**

@@ -336,8 +358,4 @@ * Called at complete of the scroll.

*/
/* eslint-disable no-unused-vars */
completeScroll(isCancel) {
}
completeScroll(isCancel) {}
/* eslint-enable no-unused-vars */
/**

@@ -349,6 +367,3 @@ * Called at each animation frame of the scroll.

*/
/* eslint-disable no-unused-vars */
stepScroll(currentTime, props) {
}
stepScroll(currentTime, props) {}
/* eslint-enable no-unused-vars */

@@ -435,3 +450,3 @@

if (!Supports.history || !historyType) return;
window.history[historyType === "replace" ? "replaceState" : "pushState"](null, null, hash);
win.history[historyType === "replace" ? "replaceState" : "pushState"](null, null, hash);
}

@@ -462,3 +477,3 @@

} else if (!isDomContentLoaded) {
} else if (!/comp|inter|loaded/.test(doc.readyState)) {
let isCompleted = false;

@@ -490,3 +505,9 @@

} else {
finalCallback(null);
raf(() => {
if (Date.now() - this.createAt.getTime() > this.options.searchContainerTimeout) {
finalCallback(null);
} else {
this.getContainer(selector, callback);
}
});
}

@@ -493,0 +514,0 @@ }

@@ -95,1 +95,15 @@ import { pow } from "./math";

}
export function warning(message) {
/* eslint-disable no-console */
if (typeof console !== "undefined" && typeof console.error === "function") {
console.error(message);
}
/* eslint-enable no-console */
/* eslint-disable no-empty */
try {
throw new Error(message);
} catch (e) {}
/* eslint-enable no-empty */
}

@@ -6,3 +6,3 @@ /*!

* @license MIT
* @version 1.0.4
* @version 1.1.0
*/

@@ -30,5 +30,126 @@

} : function (obj) {
return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj;
return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
};
var asyncGenerator = function () {
function AwaitValue(value) {
this.value = value;
}
function AsyncGenerator(gen) {
var front, back;
function send(key, arg) {
return new Promise(function (resolve, reject) {
var request = {
key: key,
arg: arg,
resolve: resolve,
reject: reject,
next: null
};
if (back) {
back = back.next = request;
} else {
front = back = request;
resume(key, arg);
}
});
}
function resume(key, arg) {
try {
var result = gen[key](arg);
var value = result.value;
if (value instanceof AwaitValue) {
Promise.resolve(value.value).then(function (arg) {
resume("next", arg);
}, function (arg) {
resume("throw", arg);
});
} else {
settle(result.done ? "return" : "normal", result.value);
}
} catch (err) {
settle("throw", err);
}
}
function settle(type, value) {
switch (type) {
case "return":
front.resolve({
value: value,
done: true
});
break;
case "throw":
front.reject(value);
break;
default:
front.resolve({
value: value,
done: false
});
break;
}
front = front.next;
if (front) {
resume(front.key, front.arg);
} else {
back = null;
}
}
this._invoke = send;
if (typeof gen.return !== "function") {
this.return = undefined;
}
}
if (typeof Symbol === "function" && Symbol.asyncIterator) {
AsyncGenerator.prototype[Symbol.asyncIterator] = function () {
return this;
};
}
AsyncGenerator.prototype.next = function (arg) {
return this._invoke("next", arg);
};
AsyncGenerator.prototype.throw = function (arg) {
return this._invoke("throw", arg);
};
AsyncGenerator.prototype.return = function (arg) {
return this._invoke("return", arg);
};
return {
wrap: function (fn) {
return function () {
return new AsyncGenerator(fn.apply(this, arguments));
};
},
await: function (value) {
return new AwaitValue(value);
}
};
}();
var classCallCheck = function (instance, Constructor) {

@@ -58,2 +179,71 @@ if (!(instance instanceof Constructor)) {

var get = function get(object, property, receiver) {
if (object === null) object = Function.prototype;
var desc = Object.getOwnPropertyDescriptor(object, property);
if (desc === undefined) {
var parent = Object.getPrototypeOf(object);
if (parent === null) {
return undefined;
} else {
return get(parent, property, receiver);
}
} else if ("value" in desc) {
return desc.value;
} else {
var getter = desc.get;
if (getter === undefined) {
return undefined;
}
return getter.call(receiver);
}
};
var set = function set(object, property, value, receiver) {
var desc = Object.getOwnPropertyDescriptor(object, property);
if (desc === undefined) {
var parent = Object.getPrototypeOf(object);
if (parent !== null) {
set(parent, property, value, receiver);
}
} else if ("value" in desc && desc.writable) {
desc.value = value;
} else {
var setter = desc.set;
if (setter !== undefined) {
setter.call(receiver, value);
}
}
return value;
};
var MAX_ARRAY_INDEX = pow(2, 53) - 1;

@@ -83,2 +273,4 @@ var classTypeList = ["Boolean", "Number", "String", "Function", "Array", "Object"];

function isFunction(obj) {

@@ -110,2 +302,4 @@ return getType(obj) === "function";

function each(obj, iterate, context) {

@@ -148,2 +342,16 @@ if (obj == null) return obj;

function warning(message) {
/* eslint-disable no-console */
if (typeof console !== "undefined" && typeof console.error === "function") {
console.error(message);
}
/* eslint-enable no-console */
/* eslint-disable no-empty */
try {
throw new Error(message);
} catch (e) {}
/* eslint-enable no-empty */
}
var win = window;

@@ -153,3 +361,3 @@ var doc = document;

function $(selector) {
var context = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];
var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;

@@ -162,3 +370,3 @@ if (!selector) return;

function $$(selector) {
var context = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];
var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;

@@ -193,5 +401,4 @@ if (!selector) return;

function getZoomLevel() {
var _window = window;
var outerWidth = _window.outerWidth;
var innerWidth = _window.innerWidth;
var outerWidth = win.outerWidth;
var innerWidth = win.innerWidth;

@@ -203,4 +410,4 @@

function getScrollable(selectors) {
var direction = arguments.length <= 1 || arguments[1] === undefined ? "y" : arguments[1];
var all = arguments.length <= 2 || arguments[2] === undefined ? true : arguments[2];
var direction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "y";
var all = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;

@@ -290,3 +497,3 @@ var method = directionMethodMap[direction];

function getScroll(el) {
var direction = arguments.length <= 1 || arguments[1] === undefined ? "y" : arguments[1];
var direction = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "y";

@@ -299,3 +506,3 @@ var currentWindow = getWindow(el);

function setScroll(el, offset) {
var direction = arguments.length <= 2 || arguments[2] === undefined ? "y" : arguments[2];
var direction = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "y";

@@ -312,3 +519,3 @@ var currentWindow = getWindow(el);

function getOffset(el) {
var context = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1];
var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;

@@ -351,3 +558,3 @@ if (!el || el && !el.getClientRects().length) {

return window.history && "pushState" in window.history && window.location.protocol !== "file:";
return win.history && "pushState" in win.history && win.location.protocol !== "file:";
}();

@@ -369,2 +576,33 @@

var vendors = ["ms", "moz", "webkit"];
var lastTime = 0;
var raf = win.requestAnimationFrame;
var caf = win.cancelAnimationFrame;
for (var x = 0; x < vendors.length && !raf; ++x) {
raf = win[vendors[x] + "RequestAnimationFrame"];
caf = win[vendors[x] + "CancelAnimationFrame"] || win[vendors[x] + "CancelRequestAnimationFrame"];
}
if (!raf) {
raf = function raf(callback) {
var currentTime = Date.now();
var timeToCall = max(0, 16 - (currentTime - lastTime));
var id = setTimeout(function () {
callback(currentTime + timeToCall);
}, timeToCall);
lastTime = currentTime + timeToCall;
return id;
};
}
if (!caf) {
caf = function caf(id) {
clearTimeout(id);
};
}
/* eslint-disable no-param-reassign, newline-before-return, max-params, new-cap */

@@ -529,3 +767,3 @@ function linear(p) {

function InBack(x, t, b, c, d) {
var s = arguments.length <= 5 || arguments[5] === undefined ? 1.70158 : arguments[5];
var s = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1.70158;

@@ -536,3 +774,3 @@ return c * (t /= d) * t * ((s + 1) * t - s) + b;

function OutBack(x, t, b, c, d) {
var s = arguments.length <= 5 || arguments[5] === undefined ? 1.70158 : arguments[5];
var s = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1.70158;

@@ -543,3 +781,3 @@ return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b;

function InOutBack(x, t, b, c, d) {
var s = arguments.length <= 5 || arguments[5] === undefined ? 1.70158 : arguments[5];
var s = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : 1.70158;

@@ -576,66 +814,35 @@ if ((t /= d / 2) < 1) {

var Easing = Object.freeze({
linear: linear,
InQuad: InQuad,
OutQuad: OutQuad,
InOutQuad: InOutQuad,
InCubic: InCubic,
OutCubic: OutCubic,
InOutCubic: InOutCubic,
InQuart: InQuart,
OutQuart: OutQuart,
InOutQuart: InOutQuart,
InQuint: InQuint,
OutQuint: OutQuint,
InOutQuint: InOutQuint,
InSine: InSine,
OutSine: OutSine,
InOutSine: InOutSine,
InExpo: InExpo,
OutExpo: OutExpo,
InOutExpo: InOutExpo,
InCirc: InCirc,
OutCirc: OutCirc,
InOutCirc: InOutCirc,
InElastic: InElastic,
OutElastic: OutElastic,
InOutElastic: InOutElastic,
InBack: InBack,
OutBack: OutBack,
InOutBack: InOutBack,
OutBounce: OutBounce,
InBounce: InBounce,
InOutBounce: InOutBounce
linear: linear,
InQuad: InQuad,
OutQuad: OutQuad,
InOutQuad: InOutQuad,
InCubic: InCubic,
OutCubic: OutCubic,
InOutCubic: InOutCubic,
InQuart: InQuart,
OutQuart: OutQuart,
InOutQuart: InOutQuart,
InQuint: InQuint,
OutQuint: OutQuint,
InOutQuint: InOutQuint,
InSine: InSine,
OutSine: OutSine,
InOutSine: InOutSine,
InExpo: InExpo,
OutExpo: OutExpo,
InOutExpo: InOutExpo,
InCirc: InCirc,
OutCirc: OutCirc,
InOutCirc: InOutCirc,
InElastic: InElastic,
OutElastic: OutElastic,
InOutElastic: InOutElastic,
InBack: InBack,
OutBack: OutBack,
InOutBack: InOutBack,
OutBounce: OutBounce,
InBounce: InBounce,
InOutBounce: InOutBounce
});
var vendors = ["ms", "moz", "webkit"];
var lastTime = 0;
var raf = win.requestAnimationFrame;
var caf = win.cancelAnimationFrame;
for (var x = 0; x < vendors.length && !raf; ++x) {
raf = win[vendors[x] + "RequestAnimationFrame"];
caf = win[vendors[x] + "CancelAnimationFrame"] || win[vendors[x] + "CancelRequestAnimationFrame"];
}
if (!raf) {
raf = function raf(callback) {
var currentTime = Date.now();
var timeToCall = max(0, 16 - (currentTime - lastTime));
var id = setTimeout(function () {
callback(currentTime + timeToCall);
}, timeToCall);
lastTime = currentTime + timeToCall;
return id;
};
}
if (!caf) {
caf = function caf(id) {
clearTimeout(id);
};
}
var ScrollTween = function () {

@@ -678,3 +885,3 @@ function ScrollTween(el) {

value: function stop() {
var gotoEnd = arguments.length <= 0 || arguments[0] === undefined ? true : arguments[0];
var gotoEnd = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
var complete = this.options.complete;

@@ -763,10 +970,4 @@

var LOAD = "load";
var isDomContentLoaded = false;
addEvent(doc, DOM_CONTENT_LOADED, function () {
isDomContentLoaded = true;
});
var SweetScroll = function () {
/* eslint-enable max-len */

@@ -783,12 +984,16 @@

var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var container = arguments.length <= 1 || arguments[1] === undefined ? "body, html" : arguments[1];
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var container = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "body, html";
classCallCheck(this, SweetScroll);
var params = merge({}, SweetScroll.defaults, options);
this.createAt = new Date();
this.options = merge({}, SweetScroll.defaults, options);
this.options = params;
this.getContainer(container, function (target) {
if (target == null) {
_this.log("Not found scrollable container. => \"" + container + "\"");
}
_this.container = target;
_this.header = $(params.header);
_this.header = $(_this.options.header);
_this.tween = new ScrollTween(target);

@@ -798,3 +1003,3 @@ _this._trigger = null;

_this.bindContainerClick();
_this.hook(params, "initialized");
_this.hook(_this.options, "initialized");
});

@@ -804,5 +1009,4 @@ }

/**
* Scroll animation to the specified position
* @param {*} distance
* @param {Object} options
* Output log
* @param {String} message
* @return {void}

@@ -817,2 +1021,17 @@ */

createClass(SweetScroll, [{
key: "log",
value: function log(message) {
if (this.options.outputLog) {
warning("[SweetScroll] " + message);
}
}
/**
* Scroll animation to the specified position
* @param {*} distance
* @param {Object} options
* @return {void}
*/
}, {
key: "to",

@@ -822,3 +1041,3 @@ value: function to(distance) {

var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
var container = this.container;

@@ -847,3 +1066,5 @@ var header = this.header;

// Does not move if the container is not found
if (!container) return;
if (!container) {
return this.log("Not found container element.");
}

@@ -867,3 +1088,5 @@ // Using the coordinates in the case of CSS Selector

if (!scroll) return;
if (!scroll) {
return this.log("Invalid parameter of distance. => " + distance);
}

@@ -906,3 +1129,3 @@ // Apply `offset` value

// Update URL
if (hash != null && hash !== window.location.hash) {
if (hash != null && hash !== win.location.hash) {
_this2.updateURLHash(hash, params.updateURL);

@@ -946,3 +1169,3 @@ }

value: function toTop(distance) {
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

@@ -965,3 +1188,3 @@ this.to(distance, merge({}, options, {

value: function toLeft(distance) {
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

@@ -984,3 +1207,3 @@ this.to(distance, merge({}, options, {

value: function toElement(el) {
var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

@@ -990,2 +1213,4 @@ if (el instanceof Element) {

this.to(offset, merge({}, options));
} else {
this.log("Invalid parameter. in toElement()");
}

@@ -1003,4 +1228,8 @@ }

value: function stop() {
var gotoEnd = arguments.length <= 0 || arguments[0] === undefined ? false : arguments[0];
var gotoEnd = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
if (!this.container) {
this.log("Not found scrollable container.");
}
if (this._stopScrollListener) {

@@ -1021,4 +1250,8 @@ this._shouldCallCancelScroll = true;

value: function update() {
var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
if (!this.container) {
this.log("Not found scrollable container.");
}
this.stop();

@@ -1040,2 +1273,6 @@ this.unbindContainerClick();

value: function destroy() {
if (!this.container) {
this.log("Not found scrollable container.");
}
this.stop();

@@ -1049,2 +1286,3 @@ this.unbindContainerClick();

/* eslint-disable no-unused-vars */
/**

@@ -1065,3 +1303,2 @@ * Called at after of the initialize.

*/
/* eslint-disable no-unused-vars */

@@ -1074,4 +1311,2 @@ }, {

/* eslint-enable no-unused-vars */
/**

@@ -1092,3 +1327,2 @@ * Called at cancel of the scroll.

*/
/* eslint-disable no-unused-vars */

@@ -1099,4 +1333,2 @@ }, {

/* eslint-enable no-unused-vars */
/**

@@ -1107,3 +1339,2 @@ * Called at complete of the scroll.

*/
/* eslint-disable no-unused-vars */

@@ -1114,4 +1345,2 @@ }, {

/* eslint-enable no-unused-vars */
/**

@@ -1123,3 +1352,2 @@ * Called at each animation frame of the scroll.

*/
/* eslint-disable no-unused-vars */

@@ -1129,3 +1357,2 @@ }, {

value: function stepScroll(currentTime, props) {}
/* eslint-enable no-unused-vars */

@@ -1218,3 +1445,3 @@

if (!history || !historyType) return;
window.history[historyType === "replace" ? "replaceState" : "pushState"](null, null, hash);
win.history[historyType === "replace" ? "replaceState" : "pushState"](null, null, hash);
}

@@ -1252,3 +1479,3 @@

finalCallback(container);
} else if (!isDomContentLoaded) {
} else if (!/comp|inter|loaded/.test(doc.readyState)) {
(function () {

@@ -1281,3 +1508,9 @@ var isCompleted = false;

} else {
finalCallback(null);
raf(function () {
if (Date.now() - _this3.createAt.getTime() > _this3.options.searchContainerTimeout) {
finalCallback(null);
} else {
_this3.getContainer(selector, callback);
}
});
}

@@ -1470,2 +1703,4 @@ }

stopPropagation: true, // Prevents further propagation of the container element click event in the bubbling phase
searchContainerTimeout: 4000, // Specifies the maximum search time of Scrollabe Container
outputLog: false, // Specify level of output to log

@@ -1483,2 +1718,2 @@ // Callbacks

})));
})));

@@ -6,4 +6,4 @@ /*!

* @license MIT
* @version 1.0.4
* @version 1.1.0
*/
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):t.SweetScroll=n()}(this,function(){"use strict";function t(t){return null==t?"":"object"===("undefined"==typeof t?"undefined":yt(t))||"function"==typeof t?bt[Object.prototype.toString.call(t)]||"object":"undefined"==typeof t?"undefined":yt(t)}function n(n){return"number"===t(n)}function e(n){return"string"===t(n)}function i(n){return"function"===t(n)}function o(t){return Array.isArray(t)}function r(t){var e=null==t?null:t.length;return n(e)&&e>=0&&e<=Ct}function l(t){return!o(t)&&t-parseFloat(t)+1>=0}function u(n){return!o(n)&&"object"===t(n)}function a(t,n){return t&&t.hasOwnProperty(n)}function c(t,n,e){if(null==t)return t;var i=e||t;if(u(t)){for(var o in t)if(a(t,o)&&n.call(i,t[o],o)===!1)break}else if(r(t))for(var l=0;l<t.length&&n.call(i,t[l],l)!==!1;l++);return t}function s(t){for(var n=arguments.length,e=Array(n>1?n-1:0),i=1;i<n;i++)e[i-1]=arguments[i];return c(e,function(n){c(n,function(n,e){t[e]=n})}),t}function f(t){return t.replace(/\s*/g,"")||""}function h(t){var n=arguments.length<=1||void 0===arguments[1]?null:arguments[1];if(t)return(null==n?Ot:n).querySelector(t)}function p(t){var n=arguments.length<=1||void 0===arguments[1]?null:arguments[1];if(t)return(null==n?Ot:n).querySelectorAll(t)}function d(t,n){for(var e=(t.document||t.ownerDocument).querySelectorAll(n),i=e.length;--i>=0&&e.item(i)!==t;);return i>-1}function v(t){return t===Ot.documentElement||t===Ot.body}function g(){var t=window,n=t.outerWidth,e=t.innerWidth;return n?n/e:1}function y(t){for(var n=arguments.length<=1||void 0===arguments[1]?"y":arguments[1],e=arguments.length<=2||void 0===arguments[2]||arguments[2],i=_t[n],o=t instanceof Element?[t]:p(t),r=[],l=Ot.createElement("div"),u=0;u<o.length;u++){var a=o[u];if(a[i]>0?r.push(a):(l.style.width=a.clientWidth+1+"px",l.style.height=a.clientHeight+1+"px",a.appendChild(l),a[i]=1.5/g(),a[i]>0&&r.push(a),a[i]=0,a.removeChild(l)),!e&&r.length>0)break}return r}function S(t,n){var e=y(t,n,!1);return e.length>=1?e[0]:null}function m(t){return null!=t&&t===t.window?t:9===t.nodeType&&t.defaultView}function C(t){return dt(t.scrollHeight,t.clientHeight,t.offsetHeight)}function k(t){return dt(t.scrollWidth,t.clientWidth,t.offsetWidth)}function b(t){return{width:k(t),height:C(t)}}function w(){return{width:dt(k(Ot.body),k(Ot.documentElement)),height:dt(C(Ot.body),C(Ot.documentElement))}}function O(t){return v(t)?{viewport:{width:vt(wt.innerWidth,Ot.documentElement.clientWidth),height:wt.innerHeight},size:w()}:{viewport:{width:t.clientWidth,height:t.clientHeight},size:b(t)}}function _(t){var n=arguments.length<=1||void 0===arguments[1]?"y":arguments[1],e=m(t);return e?e[It[n]]:t[_t[n]]}function I(t,n){var e=arguments.length<=2||void 0===arguments[2]?"y":arguments[2],i=m(t),o="y"===e;i?i.scrollTo(o?i[It.x]:n,o?n:i[It.y]):t[_t[e]]=n}function x(t){var n=arguments.length<=1||void 0===arguments[1]?null:arguments[1];if(!t||t&&!t.getClientRects().length)return{top:0,left:0};var e=t.getBoundingClientRect();if(e.width||e.height){var i={},o=null;if(null==n||v(n))o=t.ownerDocument.documentElement,i.top=wt.pageYOffset,i.left=wt.pageXOffset;else{o=n;var r=o.getBoundingClientRect();i.top=r.top*-1+o.scrollTop,i.left=r.left*-1+o.scrollLeft}return{top:e.top+i.top-o.clientTop,left:e.left+i.left-o.clientLeft}}return e}function L(t,n,e){var i=n.split(",");i.forEach(function(n){t.addEventListener(n.trim(),e,!1)})}function E(t,n,e){var i=n.split(",");i.forEach(function(n){t.removeEventListener(n.trim(),e,!1)})}function A(t){return t}function T(t,n,e,i,o){return i*(n/=o)*n+e}function z(t,n,e,i,o){return-i*(n/=o)*(n-2)+e}function M(t,n,e,i,o){return(n/=o/2)<1?i/2*n*n+e:-i/2*(--n*(n-2)-1)+e}function D(t,n,e,i,o){return i*(n/=o)*n*n+e}function Q(t,n,e,i,o){return i*((n=n/o-1)*n*n+1)+e}function W(t,n,e,i,o){return(n/=o/2)<1?i/2*n*n*n+e:i/2*((n-=2)*n*n+2)+e}function j(t,n,e,i,o){return i*(n/=o)*n*n*n+e}function B(t,n,e,i,o){return-i*((n=n/o-1)*n*n*n-1)+e}function P(t,n,e,i,o){return(n/=o/2)<1?i/2*n*n*n*n+e:-i/2*((n-=2)*n*n*n-2)+e}function R(t,n,e,i,o){return i*(n/=o)*n*n*n*n+e}function H(t,n,e,i,o){return i*((n=n/o-1)*n*n*n*n+1)+e}function q(t,n,e,i,o){return(n/=o/2)<1?i/2*n*n*n*n*n+e:i/2*((n-=2)*n*n*n*n+2)+e}function F(t,n,e,i,o){return-i*ut(n/o*(pt/2))+i+e}function U(t,n,e,i,o){return i*at(n/o*(pt/2))+e}function $(t,n,e,i,o){return-i/2*(ut(pt*n/o)-1)+e}function N(t,n,e,i,o){return 0===n?e:i*ct(2,10*(n/o-1))+e}function X(t,n,e,i,o){return n===o?e+i:i*(-ct(2,-10*n/o)+1)+e}function Y(t,n,e,i,o){return 0===n?e:n===o?e+i:(n/=o/2)<1?i/2*ct(2,10*(n-1))+e:i/2*(-ct(2,-10*--n)+2)+e}function J(t,n,e,i,o){return-i*(ft(1-(n/=o)*n)-1)+e}function V(t,n,e,i,o){return i*ft(1-(n=n/o-1)*n)+e}function G(t,n,e,i,o){return(n/=o/2)<1?-i/2*(ft(1-n*n)-1)+e:i/2*(ft(1-(n-=2)*n)+1)+e}function K(t,n,e,i,o){var r=1.70158,l=0,u=i;return 0===n?e:1===(n/=o)?e+i:(l||(l=.3*o),u<st(i)?(u=i,r=l/4):r=l/(2*pt)*ht(i/u),-(u*ct(2,10*(n-=1))*at((n*o-r)*(2*pt)/l))+e)}function Z(t,n,e,i,o){var r=1.70158,l=0,u=i;return 0===n?e:1===(n/=o)?e+i:(l||(l=.3*o),u<st(i)?(u=i,r=l/4):r=l/(2*pt)*ht(i/u),u*ct(2,-10*n)*at((n*o-r)*(2*pt)/l)+i+e)}function tt(t,n,e,i,o){var r=1.70158,l=0,u=i;return 0===n?e:2===(n/=o/2)?e+i:(l||(l=o*(.3*1.5)),u<st(i)?(u=i,r=l/4):r=l/(2*pt)*ht(i/u),n<1?-.5*(u*ct(2,10*(n-=1))*at((n*o-r)*(2*pt)/l))+e:u*ct(2,-10*(n-=1))*at((n*o-r)*(2*pt)/l)*.5+i+e)}function nt(t,n,e,i,o){var r=arguments.length<=5||void 0===arguments[5]?1.70158:arguments[5];return i*(n/=o)*n*((r+1)*n-r)+e}function et(t,n,e,i,o){var r=arguments.length<=5||void 0===arguments[5]?1.70158:arguments[5];return i*((n=n/o-1)*n*((r+1)*n+r)+1)+e}function it(t,n,e,i,o){var r=arguments.length<=5||void 0===arguments[5]?1.70158:arguments[5];return(n/=o/2)<1?i/2*(n*n*(((r*=1.525)+1)*n-r))+e:i/2*((n-=2)*n*(((r*=1.525)+1)*n+r)+2)+e}function ot(t,n,e,i,o){return(n/=o)<1/2.75?i*(7.5625*n*n)+e:n<2/2.75?i*(7.5625*(n-=1.5/2.75)*n+.75)+e:n<2.5/2.75?i*(7.5625*(n-=2.25/2.75)*n+.9375)+e:i*(7.5625*(n-=2.625/2.75)*n+.984375)+e}function rt(t,n,e,i,o){return i-ot(t,o-n,0,i,o)+e}function lt(t,n,e,i,o){return n<o/2?.5*rt(t,2*n,0,i,o)+e:.5*ot(t,2*n-o,0,i,o)+.5*i+e}var ut=Math.cos,at=Math.sin,ct=Math.pow,st=Math.abs,ft=Math.sqrt,ht=Math.asin,pt=Math.PI,dt=Math.max,vt=Math.min,gt=Math.round,yt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},St=function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")},mt=function(){function t(t,n){for(var e=0;e<n.length;e++){var i=n[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}return function(n,e,i){return e&&t(n.prototype,e),i&&t(n,i),n}}(),Ct=ct(2,53)-1,kt=["Boolean","Number","String","Function","Array","Object"],bt={};kt.forEach(function(t){bt["[object "+t+"]"]=t.toLowerCase()});for(var wt=window,Ot=document,_t={y:"scrollTop",x:"scrollLeft"},It={y:"pageYOffset",x:"pageXOffset"},xt=(function(){var t=navigator.userAgent;return(t.indexOf("Android 2.")===-1&&t.indexOf("Android 4.0")===-1||t.indexOf("Mobile Safari")===-1||t.indexOf("Chrome")!==-1||t.indexOf("Windows Phone")!==-1)&&(window.history&&"pushState"in window.history&&"file:"!==window.location.protocol)}()),Lt=Object.freeze({linear:A,InQuad:T,OutQuad:z,InOutQuad:M,InCubic:D,OutCubic:Q,InOutCubic:W,InQuart:j,OutQuart:B,InOutQuart:P,InQuint:R,OutQuint:H,InOutQuint:q,InSine:F,OutSine:U,InOutSine:$,InExpo:N,OutExpo:X,InOutExpo:Y,InCirc:J,OutCirc:V,InOutCirc:G,InElastic:K,OutElastic:Z,InOutElastic:tt,InBack:nt,OutBack:et,InOutBack:it,OutBounce:ot,InBounce:rt,InOutBounce:lt}),Et=["ms","moz","webkit"],At=0,Tt=wt.requestAnimationFrame,zt=wt.cancelAnimationFrame,Mt=0;Mt<Et.length&&!Tt;++Mt)Tt=wt[Et[Mt]+"RequestAnimationFrame"],zt=wt[Et[Mt]+"CancelAnimationFrame"]||wt[Et[Mt]+"CancelRequestAnimationFrame"];Tt||(Tt=function(t){var n=Date.now(),e=dt(0,16-(n-At)),i=setTimeout(function(){t(n+e)},e);return At=n+e,i}),zt||(zt=function(t){clearTimeout(t)});var Dt=function(){function t(n){St(this,t),this.el=n,this.props={},this.options={},this.progress=!1,this.easing=null,this.startTime=null,this.rafId=null}return mt(t,[{key:"run",value:function(t,n,e){var o=this;this.progress||(this.props={x:t,y:n},this.options=e,this.easing=i(e.easing)?e.easing:Lt[e.easing.replace("ease","")],this.progress=!0,setTimeout(function(){o.startProps={x:_(o.el,"x"),y:_(o.el,"y")},o.rafId=Tt(function(t){return o._loop(t)})},this.options.delay))}},{key:"stop",value:function(){var t=arguments.length<=0||void 0===arguments[0]||arguments[0],n=this.options.complete;this.startTime=null,this.progress=!1,zt(this.rafId),t&&(I(this.el,this.props.x,"x"),I(this.el,this.props.y,"y")),i(n)&&(n.call(this),this.options.complete=null)}},{key:"_loop",value:function(t){var n=this;if(this.startTime||(this.startTime=t),!this.progress)return void this.stop(!1);var e=this.el,i=this.props,o=this.options,r=this.startTime,l=this.startProps,u=this.easing,a=o.duration,s=o.step,f={},h=t-r,p=vt(1,dt(h/a,0));c(i,function(t,n){var e=l[n],i=t-e;if(0===i)return!0;var o=u(p,a*p,0,1,a);f[n]=gt(e+i*o)}),c(f,function(t,n){I(e,t,n)}),h<=a?(s.call(this,p,f),this.rafId=Tt(function(t){return n._loop(t)})):this.stop(!0)}}]),t}(),Qt=function(){return"onwheel"in Ot?"wheel":"onmousewheel"in Ot?"mousewheel":"DOMMouseScroll"}(),Wt=Qt+", touchstart, touchmove",jt="DOMContentLoaded",Bt="load",Pt=!1;L(Ot,jt,function(){Pt=!0});var Rt=function(){function t(){var n=this,e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],i=arguments.length<=1||void 0===arguments[1]?"body, html":arguments[1];St(this,t);var o=s({},t.defaults,e);this.options=o,this.getContainer(i,function(t){n.container=t,n.header=h(o.header),n.tween=new Dt(t),n._trigger=null,n._shouldCallCancelScroll=!1,n.bindContainerClick(),n.hook(o,"initialized")})}return mt(t,[{key:"to",value:function(t){var n=this,i=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],o=this.container,r=this.header,l=s({},this.options,i);this._options=l;var u=this.parseCoodinate(l.offset),a=this._trigger,c=this.parseCoodinate(t),f=null;if(this._trigger=null,this._shouldCallCancelScroll=!1,this.stop(),o){if(!c&&e(t))if(f=/^#/.test(t)?t:null,"#"===t)c={top:0,left:0};else{var p=h(t),d=x(p,o);if(!d)return;c=d}if(c){u&&(c.top+=u.top,c.left+=u.left),r&&(c.top=dt(0,c.top-b(r).height));var v=O(o),g=v.viewport,y=v.size;this.hook(l,"beforeScroll",c,a)!==!1&&(c.top=l.verticalScroll?dt(0,vt(y.height-g.height,c.top)):_(o,"y"),c.left=l.horizontalScroll?dt(0,vt(y.width-g.width,c.left)):_(o,"x"),this.tween.run(c.left,c.top,{duration:l.duration,delay:l.delay,easing:l.easing,complete:function(){null!=f&&f!==window.location.hash&&n.updateURLHash(f,l.updateURL),n.unbindContainerStop(),n._options=null,n._shouldCallCancelScroll?n.hook(l,"cancelScroll"):n.hook(l,"afterScroll",c,a),n.hook(l,"completeScroll",n._shouldCallCancelScroll)},step:function(t,e){n.hook(l,"stepScroll",t,e)}}),this.bindContainerStop())}}}},{key:"toTop",value:function(t){var n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];this.to(t,s({},n,{verticalScroll:!0,horizontalScroll:!1}))}},{key:"toLeft",value:function(t){var n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];this.to(t,s({},n,{verticalScroll:!1,horizontalScroll:!0}))}},{key:"toElement",value:function(t){var n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];if(t instanceof Element){var e=x(t,this.container);this.to(e,s({},n))}}},{key:"stop",value:function(){var t=!(arguments.length<=0||void 0===arguments[0])&&arguments[0];this._stopScrollListener&&(this._shouldCallCancelScroll=!0),this.tween.stop(t)}},{key:"update",value:function(){var t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];this.stop(),this.unbindContainerClick(),this.unbindContainerStop(),this.options=s({},this.options,t),this.header=h(this.options.header),this.bindContainerClick()}},{key:"destroy",value:function(){this.stop(),this.unbindContainerClick(),this.unbindContainerStop(),this.container=null,this.header=null,this.tween=null}},{key:"initialized",value:function(){}},{key:"beforeScroll",value:function(t,n){return!0}},{key:"cancelScroll",value:function(){}},{key:"afterScroll",value:function(t,n){}},{key:"completeScroll",value:function(t){}},{key:"stepScroll",value:function(t,n){}},{key:"parseCoodinate",value:function(t){var n=this._options?this._options.verticalScroll:this.options.verticalScroll,i={top:0,left:0};if(a(t,"top")||a(t,"left"))i=s(i,t);else if(o(t))2===t.length?(i.top=t[0],i.left=t[1]):(i.top=n?t[0]:0,i.left=n?0:t[0]);else if(l(t))i.top=n?t:0,i.left=n?0:t;else{if(!e(t))return null;var r=f(t);if(/^\d+,\d+$/.test(r))r=r.split(","),i.top=r[0],i.left=r[1];else if(/^(top|left):\d+,?(?:(top|left):\d+)?$/.test(r)){var u=r.match(/top:(\d+)/),c=r.match(/left:(\d+)/);i.top=u?u[1]:0,i.left=c?c[1]:0}else{if(!this.container||!/^(\+|-)=(\d+)$/.test(r))return null;var h=_(this.container,n?"y":"x"),p=r.match(/^(\+|-)=(\d+)$/),d=p[1],v=parseInt(p[2],10);"+"===d?(i.top=n?h+v:0,i.left=n?0:h+v):(i.top=n?h-v:0,i.left=n?0:h-v)}}return i.top=parseInt(i.top,10),i.left=parseInt(i.left,10),i}},{key:"updateURLHash",value:function(t,n){xt&&n&&window.history["replace"===n?"replaceState":"pushState"](null,null,t)}},{key:"getContainer",value:function(t,n){var e=this,i=this.options,o=i.verticalScroll,r=i.horizontalScroll,l=n.bind(this),u=null;o&&(u=S(t,"y")),!u&&r&&(u=S(t,"x")),u?l(u):Pt?l(null):!function(){var i=!1,o=function(){l(),i=!0,e.getContainer(t,n)},r=function(){l(),i||e.getContainer(t,n)},l=function(){E(Ot,jt,o),E(wt,Bt,r)};L(Ot,jt,o),L(wt,Bt,r)}()}},{key:"bindContainerClick",value:function(){var t=this.container;t&&(this._containerClickListener=this.handleContainerClick.bind(this),L(t,"click",this._containerClickListener))}},{key:"unbindContainerClick",value:function(){var t=this.container;t&&this._containerClickListener&&(E(t,"click",this._containerClickListener),this._containerClickListener=null)}},{key:"bindContainerStop",value:function(){var t=this.container;t&&(this._stopScrollListener=this.handleStopScroll.bind(this),L(t,Wt,this._stopScrollListener))}},{key:"unbindContainerStop",value:function(){var t=this.container;t&&this._stopScrollListener&&(E(t,Wt,this._stopScrollListener),this._stopScrollListener=null)}},{key:"hook",value:function(t,n){for(var e=t[n],o=arguments.length,r=Array(o>2?o-2:0),l=2;l<o;l++)r[l-2]=arguments[l];if(i(e)){var u=e.apply(this,r);if("undefined"==typeof u)return u}return this[n].apply(this,r)}},{key:"handleStopScroll",value:function(t){var n=this._options?this._options.stopScroll:this.options.stopScroll;n?this.stop():t.preventDefault()}},{key:"handleContainerClick",value:function(t){for(var n=this.options,e=t.target;e&&e!==Ot;e=e.parentNode)if(d(e,n.trigger)){var i=e.getAttribute("data-scroll"),o=this.parseDataOptions(e),r=i||e.getAttribute("href");n=s({},n,o),n.preventDefault&&t.preventDefault(),n.stopPropagation&&t.stopPropagation(),this._trigger=e,n.horizontalScroll&&n.verticalScroll?this.to(r,n):n.verticalScroll?this.toTop(r,n):n.horizontalScroll&&this.toLeft(r,n)}}},{key:"parseDataOptions",value:function(t){var n=t.getAttribute("data-scroll-options");return n?JSON.parse(n):{}}}]),t}();return Rt.defaults={trigger:"[data-scroll]",header:"[data-scroll-header]",duration:1e3,delay:0,easing:"easeOutQuint",offset:0,verticalScroll:!0,horizontalScroll:!1,stopScroll:!0,updateURL:!1,preventDefault:!0,stopPropagation:!0,initialized:null,beforeScroll:null,afterScroll:null,cancelScroll:null,completeScroll:null,stepScroll:null},Rt});
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):t.SweetScroll=n()}(this,function(){"use strict";function t(t){return null==t?"":"object"===("undefined"==typeof t?"undefined":mt(t))||"function"==typeof t?wt[Object.prototype.toString.call(t)]||"object":"undefined"==typeof t?"undefined":mt(t)}function n(n){return"number"===t(n)}function e(n){return"string"===t(n)}function o(n){return"function"===t(n)}function i(t){return Array.isArray(t)}function r(t){var e=null==t?null:t.length;return n(e)&&e>=0&&e<=bt}function l(t){return!i(t)&&t-parseFloat(t)+1>=0}function u(n){return!i(n)&&"object"===t(n)}function a(t,n){return t&&t.hasOwnProperty(n)}function c(t,n,e){if(null==t)return t;var o=e||t;if(u(t)){for(var i in t)if(a(t,i)&&n.call(o,t[i],i)===!1)break}else if(r(t))for(var l=0;l<t.length&&n.call(o,t[l],l)!==!1;l++);return t}function s(t){for(var n=arguments.length,e=Array(n>1?n-1:0),o=1;o<n;o++)e[o-1]=arguments[o];return c(e,function(n){c(n,function(n,e){t[e]=n})}),t}function f(t){return t.replace(/\s*/g,"")||""}function h(t){"undefined"!=typeof console&&"function"==typeof console.error&&console.error(t);try{throw new Error(t)}catch(t){}}function p(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t)return(null==n?_t:n).querySelector(t)}function d(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t)return(null==n?_t:n).querySelectorAll(t)}function v(t,n){for(var e=(t.document||t.ownerDocument).querySelectorAll(n),o=e.length;--o>=0&&e.item(o)!==t;);return o>-1}function g(t){return t===_t.documentElement||t===_t.body}function y(){var t=Ot.outerWidth,n=Ot.innerWidth;return t?t/n:1}function m(t){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"y",e=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],o=It[n],i=t instanceof Element?[t]:d(t),r=[],l=_t.createElement("div"),u=0;u<i.length;u++){var a=i[u];if(a[o]>0?r.push(a):(l.style.width=a.clientWidth+1+"px",l.style.height=a.clientHeight+1+"px",a.appendChild(l),a[o]=1.5/y(),a[o]>0&&r.push(a),a[o]=0,a.removeChild(l)),!e&&r.length>0)break}return r}function S(t,n){var e=m(t,n,!1);return e.length>=1?e[0]:null}function k(t){return null!=t&&t===t.window?t:9===t.nodeType&&t.defaultView}function b(t){return vt(t.scrollHeight,t.clientHeight,t.offsetHeight)}function C(t){return vt(t.scrollWidth,t.clientWidth,t.offsetWidth)}function w(t){return{width:C(t),height:b(t)}}function O(){return{width:vt(C(_t.body),C(_t.documentElement)),height:vt(b(_t.body),b(_t.documentElement))}}function _(t){return g(t)?{viewport:{width:gt(Ot.innerWidth,_t.documentElement.clientWidth),height:Ot.innerHeight},size:O()}:{viewport:{width:t.clientWidth,height:t.clientHeight},size:w(t)}}function I(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"y",e=k(t);return e?e[xt[n]]:t[It[n]]}function x(t,n){var e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"y",o=k(t),i="y"===e;o?o.scrollTo(i?o[xt.x]:n,i?n:o[xt.y]):t[It[e]]=n}function L(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(!t||t&&!t.getClientRects().length)return{top:0,left:0};var e=t.getBoundingClientRect();if(e.width||e.height){var o={},i=null;if(null==n||g(n))i=t.ownerDocument.documentElement,o.top=Ot.pageYOffset,o.left=Ot.pageXOffset;else{i=n;var r=i.getBoundingClientRect();o.top=r.top*-1+i.scrollTop,o.left=r.left*-1+i.scrollLeft}return{top:e.top+o.top-i.clientTop,left:e.left+o.left-i.clientLeft}}return e}function E(t,n,e){var o=n.split(",");o.forEach(function(n){t.addEventListener(n.trim(),e,!1)})}function A(t,n,e){var o=n.split(",");o.forEach(function(n){t.removeEventListener(n.trim(),e,!1)})}function T(t){return t}function z(t,n,e,o,i){return o*(n/=i)*n+e}function M(t,n,e,o,i){return-o*(n/=i)*(n-2)+e}function D(t,n,e,o,i){return(n/=i/2)<1?o/2*n*n+e:-o/2*(--n*(n-2)-1)+e}function j(t,n,e,o,i){return o*(n/=i)*n*n+e}function P(t,n,e,o,i){return o*((n=n/i-1)*n*n+1)+e}function Q(t,n,e,o,i){return(n/=i/2)<1?o/2*n*n*n+e:o/2*((n-=2)*n*n+2)+e}function W(t,n,e,o,i){return o*(n/=i)*n*n*n+e}function B(t,n,e,o,i){return-o*((n=n/i-1)*n*n*n-1)+e}function R(t,n,e,o,i){return(n/=i/2)<1?o/2*n*n*n*n+e:-o/2*((n-=2)*n*n*n-2)+e}function H(t,n,e,o,i){return o*(n/=i)*n*n*n*n+e}function N(t,n,e,o,i){return o*((n=n/i-1)*n*n*n*n+1)+e}function q(t,n,e,o,i){return(n/=i/2)<1?o/2*n*n*n*n*n+e:o/2*((n-=2)*n*n*n*n+2)+e}function F(t,n,e,o,i){return-o*at(n/i*(dt/2))+o+e}function U(t,n,e,o,i){return o*ct(n/i*(dt/2))+e}function $(t,n,e,o,i){return-o/2*(at(dt*n/i)-1)+e}function X(t,n,e,o,i){return 0===n?e:o*st(2,10*(n/i-1))+e}function Y(t,n,e,o,i){return n===i?e+o:o*(-st(2,-10*n/i)+1)+e}function J(t,n,e,o,i){return 0===n?e:n===i?e+o:(n/=i/2)<1?o/2*st(2,10*(n-1))+e:o/2*(-st(2,-10*--n)+2)+e}function V(t,n,e,o,i){return-o*(ht(1-(n/=i)*n)-1)+e}function G(t,n,e,o,i){return o*ht(1-(n=n/i-1)*n)+e}function K(t,n,e,o,i){return(n/=i/2)<1?-o/2*(ht(1-n*n)-1)+e:o/2*(ht(1-(n-=2)*n)+1)+e}function Z(t,n,e,o,i){var r=1.70158,l=0,u=o;return 0===n?e:1===(n/=i)?e+o:(l||(l=.3*i),u<ft(o)?(u=o,r=l/4):r=l/(2*dt)*pt(o/u),-(u*st(2,10*(n-=1))*ct((n*i-r)*(2*dt)/l))+e)}function tt(t,n,e,o,i){var r=1.70158,l=0,u=o;return 0===n?e:1===(n/=i)?e+o:(l||(l=.3*i),u<ft(o)?(u=o,r=l/4):r=l/(2*dt)*pt(o/u),u*st(2,-10*n)*ct((n*i-r)*(2*dt)/l)+o+e)}function nt(t,n,e,o,i){var r=1.70158,l=0,u=o;return 0===n?e:2===(n/=i/2)?e+o:(l||(l=i*(.3*1.5)),u<ft(o)?(u=o,r=l/4):r=l/(2*dt)*pt(o/u),n<1?-.5*(u*st(2,10*(n-=1))*ct((n*i-r)*(2*dt)/l))+e:u*st(2,-10*(n-=1))*ct((n*i-r)*(2*dt)/l)*.5+o+e)}function et(t,n,e,o,i){var r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1.70158;return o*(n/=i)*n*((r+1)*n-r)+e}function ot(t,n,e,o,i){var r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1.70158;return o*((n=n/i-1)*n*((r+1)*n+r)+1)+e}function it(t,n,e,o,i){var r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1.70158;return(n/=i/2)<1?o/2*(n*n*(((r*=1.525)+1)*n-r))+e:o/2*((n-=2)*n*(((r*=1.525)+1)*n+r)+2)+e}function rt(t,n,e,o,i){return(n/=i)<1/2.75?o*(7.5625*n*n)+e:n<2/2.75?o*(7.5625*(n-=1.5/2.75)*n+.75)+e:n<2.5/2.75?o*(7.5625*(n-=2.25/2.75)*n+.9375)+e:o*(7.5625*(n-=2.625/2.75)*n+.984375)+e}function lt(t,n,e,o,i){return o-rt(t,i-n,0,o,i)+e}function ut(t,n,e,o,i){return n<i/2?.5*lt(t,2*n,0,o,i)+e:.5*rt(t,2*n-i,0,o,i)+.5*o+e}var at=Math.cos,ct=Math.sin,st=Math.pow,ft=Math.abs,ht=Math.sqrt,pt=Math.asin,dt=Math.PI,vt=Math.max,gt=Math.min,yt=Math.round,mt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},St=(function(){function t(t){this.value=t}function n(n){function e(t,n){return new Promise(function(e,i){var u={key:t,arg:n,resolve:e,reject:i,next:null};l?l=l.next=u:(r=l=u,o(t,n))})}function o(e,r){try{var l=n[e](r),u=l.value;u instanceof t?Promise.resolve(u.value).then(function(t){o("next",t)},function(t){o("throw",t)}):i(l.done?"return":"normal",l.value)}catch(t){i("throw",t)}}function i(t,n){switch(t){case"return":r.resolve({value:n,done:!0});break;case"throw":r.reject(n);break;default:r.resolve({value:n,done:!1})}r=r.next,r?o(r.key,r.arg):l=null}var r,l;this._invoke=e,"function"!=typeof n.return&&(this.return=void 0)}return"function"==typeof Symbol&&Symbol.asyncIterator&&(n.prototype[Symbol.asyncIterator]=function(){return this}),n.prototype.next=function(t){return this._invoke("next",t)},n.prototype.throw=function(t){return this._invoke("throw",t)},n.prototype.return=function(t){return this._invoke("return",t)},{wrap:function(t){return function(){return new n(t.apply(this,arguments))}},await:function(n){return new t(n)}}}(),function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}),kt=function(){function t(t,n){for(var e=0;e<n.length;e++){var o=n[e];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}return function(n,e,o){return e&&t(n.prototype,e),o&&t(n,o),n}}(),bt=st(2,53)-1,Ct=["Boolean","Number","String","Function","Array","Object"],wt={};Ct.forEach(function(t){wt["[object "+t+"]"]=t.toLowerCase()});for(var Ot=window,_t=document,It={y:"scrollTop",x:"scrollLeft"},xt={y:"pageYOffset",x:"pageXOffset"},Lt=(function(){var t=navigator.userAgent;return(t.indexOf("Android 2.")===-1&&t.indexOf("Android 4.0")===-1||t.indexOf("Mobile Safari")===-1||t.indexOf("Chrome")!==-1||t.indexOf("Windows Phone")!==-1)&&(Ot.history&&"pushState"in Ot.history&&"file:"!==Ot.location.protocol)}()),Et=["ms","moz","webkit"],At=0,Tt=Ot.requestAnimationFrame,zt=Ot.cancelAnimationFrame,Mt=0;Mt<Et.length&&!Tt;++Mt)Tt=Ot[Et[Mt]+"RequestAnimationFrame"],zt=Ot[Et[Mt]+"CancelAnimationFrame"]||Ot[Et[Mt]+"CancelRequestAnimationFrame"];Tt||(Tt=function(t){var n=Date.now(),e=vt(0,16-(n-At)),o=setTimeout(function(){t(n+e)},e);return At=n+e,o}),zt||(zt=function(t){clearTimeout(t)});var Dt=Object.freeze({linear:T,InQuad:z,OutQuad:M,InOutQuad:D,InCubic:j,OutCubic:P,InOutCubic:Q,InQuart:W,OutQuart:B,InOutQuart:R,InQuint:H,OutQuint:N,InOutQuint:q,InSine:F,OutSine:U,InOutSine:$,InExpo:X,OutExpo:Y,InOutExpo:J,InCirc:V,OutCirc:G,InOutCirc:K,InElastic:Z,OutElastic:tt,InOutElastic:nt,InBack:et,OutBack:ot,InOutBack:it,OutBounce:rt,InBounce:lt,InOutBounce:ut}),jt=function(){function t(n){St(this,t),this.el=n,this.props={},this.options={},this.progress=!1,this.easing=null,this.startTime=null,this.rafId=null}return kt(t,[{key:"run",value:function(t,n,e){var i=this;this.progress||(this.props={x:t,y:n},this.options=e,this.easing=o(e.easing)?e.easing:Dt[e.easing.replace("ease","")],this.progress=!0,setTimeout(function(){i.startProps={x:I(i.el,"x"),y:I(i.el,"y")},i.rafId=Tt(function(t){return i._loop(t)})},this.options.delay))}},{key:"stop",value:function(){var t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],n=this.options.complete;this.startTime=null,this.progress=!1,zt(this.rafId),t&&(x(this.el,this.props.x,"x"),x(this.el,this.props.y,"y")),o(n)&&(n.call(this),this.options.complete=null)}},{key:"_loop",value:function(t){var n=this;if(this.startTime||(this.startTime=t),!this.progress)return void this.stop(!1);var e=this.el,o=this.props,i=this.options,r=this.startTime,l=this.startProps,u=this.easing,a=i.duration,s=i.step,f={},h=t-r,p=gt(1,vt(h/a,0));c(o,function(t,n){var e=l[n],o=t-e;if(0===o)return!0;var i=u(p,a*p,0,1,a);f[n]=yt(e+o*i)}),c(f,function(t,n){x(e,t,n)}),h<=a?(s.call(this,p,f),this.rafId=Tt(function(t){return n._loop(t)})):this.stop(!0)}}]),t}(),Pt=function(){return"onwheel"in _t?"wheel":"onmousewheel"in _t?"mousewheel":"DOMMouseScroll"}(),Qt=Pt+", touchstart, touchmove",Wt="DOMContentLoaded",Bt="load",Rt=function(){function t(){var n=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"body, html";St(this,t),this.createAt=new Date,this.options=s({},t.defaults,e),this.getContainer(o,function(t){null==t&&n.log('Not found scrollable container. => "'+o+'"'),n.container=t,n.header=p(n.options.header),n.tween=new jt(t),n._trigger=null,n._shouldCallCancelScroll=!1,n.bindContainerClick(),n.hook(n.options,"initialized")})}return kt(t,[{key:"log",value:function(t){this.options.outputLog&&h("[SweetScroll] "+t)}},{key:"to",value:function(t){var n=this,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=this.container,r=this.header,l=s({},this.options,o);this._options=l;var u=this.parseCoodinate(l.offset),a=this._trigger,c=this.parseCoodinate(t),f=null;if(this._trigger=null,this._shouldCallCancelScroll=!1,this.stop(),!i)return this.log("Not found container element.");if(!c&&e(t))if(f=/^#/.test(t)?t:null,"#"===t)c={top:0,left:0};else{var h=p(t),d=L(h,i);if(!d)return;c=d}if(!c)return this.log("Invalid parameter of distance. => "+t);u&&(c.top+=u.top,c.left+=u.left),r&&(c.top=vt(0,c.top-w(r).height));var v=_(i),g=v.viewport,y=v.size;this.hook(l,"beforeScroll",c,a)!==!1&&(c.top=l.verticalScroll?vt(0,gt(y.height-g.height,c.top)):I(i,"y"),c.left=l.horizontalScroll?vt(0,gt(y.width-g.width,c.left)):I(i,"x"),this.tween.run(c.left,c.top,{duration:l.duration,delay:l.delay,easing:l.easing,complete:function(){null!=f&&f!==Ot.location.hash&&n.updateURLHash(f,l.updateURL),n.unbindContainerStop(),n._options=null,n._shouldCallCancelScroll?n.hook(l,"cancelScroll"):n.hook(l,"afterScroll",c,a),n.hook(l,"completeScroll",n._shouldCallCancelScroll)},step:function(t,e){n.hook(l,"stepScroll",t,e)}}),this.bindContainerStop())}},{key:"toTop",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.to(t,s({},n,{verticalScroll:!0,horizontalScroll:!1}))}},{key:"toLeft",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.to(t,s({},n,{verticalScroll:!1,horizontalScroll:!0}))}},{key:"toElement",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t instanceof Element){var e=L(t,this.container);this.to(e,s({},n))}else this.log("Invalid parameter. in toElement()")}},{key:"stop",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.container||this.log("Not found scrollable container."),this._stopScrollListener&&(this._shouldCallCancelScroll=!0),this.tween.stop(t)}},{key:"update",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.container||this.log("Not found scrollable container."),this.stop(),this.unbindContainerClick(),this.unbindContainerStop(),this.options=s({},this.options,t),this.header=p(this.options.header),this.bindContainerClick()}},{key:"destroy",value:function(){this.container||this.log("Not found scrollable container."),this.stop(),this.unbindContainerClick(),this.unbindContainerStop(),this.container=null,this.header=null,this.tween=null}},{key:"initialized",value:function(){}},{key:"beforeScroll",value:function(t,n){return!0}},{key:"cancelScroll",value:function(){}},{key:"afterScroll",value:function(t,n){}},{key:"completeScroll",value:function(t){}},{key:"stepScroll",value:function(t,n){}},{key:"parseCoodinate",value:function(t){var n=this._options?this._options.verticalScroll:this.options.verticalScroll,o={top:0,left:0};if(a(t,"top")||a(t,"left"))o=s(o,t);else if(i(t))2===t.length?(o.top=t[0],o.left=t[1]):(o.top=n?t[0]:0,o.left=n?0:t[0]);else if(l(t))o.top=n?t:0,o.left=n?0:t;else{if(!e(t))return null;var r=f(t);if(/^\d+,\d+$/.test(r))r=r.split(","),o.top=r[0],o.left=r[1];else if(/^(top|left):\d+,?(?:(top|left):\d+)?$/.test(r)){var u=r.match(/top:(\d+)/),c=r.match(/left:(\d+)/);o.top=u?u[1]:0,o.left=c?c[1]:0}else{if(!this.container||!/^(\+|-)=(\d+)$/.test(r))return null;var h=I(this.container,n?"y":"x"),p=r.match(/^(\+|-)=(\d+)$/),d=p[1],v=parseInt(p[2],10);"+"===d?(o.top=n?h+v:0,o.left=n?0:h+v):(o.top=n?h-v:0,o.left=n?0:h-v)}}return o.top=parseInt(o.top,10),o.left=parseInt(o.left,10),o}},{key:"updateURLHash",value:function(t,n){Lt&&n&&Ot.history["replace"===n?"replaceState":"pushState"](null,null,t)}},{key:"getContainer",value:function(t,n){var e=this,o=this.options,i=o.verticalScroll,r=o.horizontalScroll,l=n.bind(this),u=null;i&&(u=S(t,"y")),!u&&r&&(u=S(t,"x")),u?l(u):/comp|inter|loaded/.test(_t.readyState)?Tt(function(){Date.now()-e.createAt.getTime()>e.options.searchContainerTimeout?l(null):e.getContainer(t,n)}):!function(){var o=!1,i=function(){l(),o=!0,e.getContainer(t,n)},r=function(){l(),o||e.getContainer(t,n)},l=function(){A(_t,Wt,i),A(Ot,Bt,r)};E(_t,Wt,i),E(Ot,Bt,r)}()}},{key:"bindContainerClick",value:function(){var t=this.container;t&&(this._containerClickListener=this.handleContainerClick.bind(this),E(t,"click",this._containerClickListener))}},{key:"unbindContainerClick",value:function(){var t=this.container;t&&this._containerClickListener&&(A(t,"click",this._containerClickListener),this._containerClickListener=null)}},{key:"bindContainerStop",value:function(){var t=this.container;t&&(this._stopScrollListener=this.handleStopScroll.bind(this),E(t,Qt,this._stopScrollListener))}},{key:"unbindContainerStop",value:function(){var t=this.container;t&&this._stopScrollListener&&(A(t,Qt,this._stopScrollListener),this._stopScrollListener=null)}},{key:"hook",value:function(t,n){for(var e=t[n],i=arguments.length,r=Array(i>2?i-2:0),l=2;l<i;l++)r[l-2]=arguments[l];if(o(e)){var u=e.apply(this,r);if("undefined"==typeof u)return u}return this[n].apply(this,r)}},{key:"handleStopScroll",value:function(t){var n=this._options?this._options.stopScroll:this.options.stopScroll;n?this.stop():t.preventDefault()}},{key:"handleContainerClick",value:function(t){for(var n=this.options,e=t.target;e&&e!==_t;e=e.parentNode)if(v(e,n.trigger)){var o=e.getAttribute("data-scroll"),i=this.parseDataOptions(e),r=o||e.getAttribute("href");n=s({},n,i),n.preventDefault&&t.preventDefault(),n.stopPropagation&&t.stopPropagation(),this._trigger=e,n.horizontalScroll&&n.verticalScroll?this.to(r,n):n.verticalScroll?this.toTop(r,n):n.horizontalScroll&&this.toLeft(r,n)}}},{key:"parseDataOptions",value:function(t){var n=t.getAttribute("data-scroll-options");return n?JSON.parse(n):{}}}]),t}();return Rt.defaults={trigger:"[data-scroll]",header:"[data-scroll-header]",duration:1e3,delay:0,easing:"easeOutQuint",offset:0,verticalScroll:!0,horizontalScroll:!1,stopScroll:!0,updateURL:!1,preventDefault:!0,stopPropagation:!0,searchContainerTimeout:4e3,outputLog:!1,initialized:null,beforeScroll:null,afterScroll:null,cancelScroll:null,completeScroll:null,stepScroll:null},Rt});
/* eslint-disable no-underscore-dangle, no-undefined */
import assert from "power-assert";
import sinon from "sinon";
import SweetScroll from "../src/sweet-scroll";

@@ -13,4 +14,4 @@

function getInstance(options = {}) {
return new SweetScroll(options, "#container");
function getInstance(options = {}, container = "#container") {
return new SweetScroll(options, container);
}

@@ -23,3 +24,13 @@

let clock = null;
describe("SweetScroll", () => {
before(() => {
clock = sinon.useFakeTimers();
});
after(() => {
clock.restore();
});
beforeEach(() => {

@@ -37,2 +48,3 @@ document.body.innerHTML = window.__html__["test/fixtures/sweet-scroll.html"];

getInstance({
searchContainerTimeout: 1000,
initialized() {

@@ -43,2 +55,4 @@ assert(this.container == null);

});
clock.tick(1200);
});

@@ -161,8 +175,11 @@

it("Should be run afterScroll", done => {
const sweetScroll = getInstance({ afterScroll(toScroll) {
assert(toScroll.top === 500);
assert(toScroll.left === 0);
done();
} });
const sweetScroll = getInstance({
afterScroll(toScroll) {
assert(toScroll.top === 500);
assert(toScroll.left === 0);
done();
}
});
sweetScroll.to(500);
clock.tick(1000);
});

@@ -174,5 +191,4 @@

sweetScroll.to(1200);
setTimeout(() => {
trigger($container, "touchstart");
}, 500);
clock.tick(500);
trigger($container, "touchstart");
});

@@ -188,2 +204,3 @@

sweetScroll.to(1200);
clock.tick(1000);
});

@@ -200,5 +217,4 @@

sweetScroll.to(1200);
setTimeout(() => {
trigger($container, "touchstart");
}, 500);
clock.tick(500);
trigger($container, "touchstart");
});

@@ -230,2 +246,3 @@ });

myScroll.to(500);
clock.tick(1000);
});

@@ -242,5 +259,4 @@

myScroll.to(1200);
setTimeout(() => {
trigger($container, "touchstart");
}, 500);
clock.tick(500);
trigger($container, "touchstart");
});

@@ -257,2 +273,3 @@

myScroll.to(1200);
clock.tick(1000);
});

@@ -270,5 +287,4 @@

myScroll.to(1200);
setTimeout(() => {
trigger($container, "touchstart");
}, 500);
clock.tick(500);
trigger($container, "touchstart");
});

@@ -287,2 +303,3 @@ });

trigger(getAnchor(), "click");
clock.tick(1000);
});

@@ -293,2 +310,3 @@

trigger(getAnchor(), "click");
clock.tick(1000);
});

@@ -300,5 +318,4 @@

trigger(getAnchor(), "click");
setTimeout(() => {
trigger($container, "touchstart");
}, 500);
clock.tick(500);
trigger($container, "touchstart");
});

@@ -309,4 +326,5 @@

trigger(getAnchor(), "click");
clock.tick(1000);
});
});
});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc