scroll-smooth
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -94,3 +94,3 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
exports.default = function (elem) { | ||
exports.default = function (target) { | ||
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, | ||
@@ -110,3 +110,3 @@ _ref$duration = _ref.duration, | ||
var start = context.scrollTop || window.pageYOffset; | ||
var end = (0, _tools.calcEndPoint)(elem, context, offset); | ||
var end = (0, _tools.calcEndPoint)(target, context, offset); | ||
var clock = performance.now(); | ||
@@ -125,3 +125,3 @@ var rAF = window.requestAnimationFrame; | ||
if (elapsed > duration) { | ||
typeof callback === 'function' && callback(elem); | ||
typeof callback === 'function' && callback(target); | ||
} else { | ||
@@ -199,8 +199,8 @@ rAF(tick); | ||
var calcEndPoint = exports.calcEndPoint = function calcEndPoint(elem) { | ||
var calcEndPoint = exports.calcEndPoint = function calcEndPoint(target) { | ||
var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window; | ||
var offset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; | ||
if (isNumeric(elem)) { | ||
return parseInt(elem) + offset; | ||
if (isNumeric(target)) { | ||
return parseInt(target) + offset; | ||
} | ||
@@ -210,3 +210,3 @@ | ||
var distance = elem.nodeName.toLowerCase() === 'html' ? -y : elem.getBoundingClientRect().top + y; | ||
var distance = target.nodeName.toLowerCase() === 'html' ? -y : target.getBoundingClientRect().top + y; | ||
@@ -213,0 +213,0 @@ return distance + offset; |
@@ -11,3 +11,3 @@ 'use strict'; | ||
exports.default = function (elem) { | ||
exports.default = function (target) { | ||
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}, | ||
@@ -27,3 +27,3 @@ _ref$duration = _ref.duration, | ||
var start = context.scrollTop || window.pageYOffset; | ||
var end = (0, _tools.calcEndPoint)(elem, context, offset); | ||
var end = (0, _tools.calcEndPoint)(target, context, offset); | ||
var clock = performance.now(); | ||
@@ -42,3 +42,3 @@ var rAF = window.requestAnimationFrame; | ||
if (elapsed > duration) { | ||
typeof callback === 'function' && callback(elem); | ||
typeof callback === 'function' && callback(target); | ||
} else { | ||
@@ -45,0 +45,0 @@ rAF(tick); |
@@ -58,8 +58,8 @@ 'use strict'; | ||
var calcEndPoint = exports.calcEndPoint = function calcEndPoint(elem) { | ||
var calcEndPoint = exports.calcEndPoint = function calcEndPoint(target) { | ||
var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : window; | ||
var offset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; | ||
if (isNumeric(elem)) { | ||
return parseInt(elem) + offset; | ||
if (isNumeric(target)) { | ||
return parseInt(target) + offset; | ||
} | ||
@@ -69,5 +69,5 @@ | ||
var distance = elem.nodeName.toLowerCase() === 'html' ? -y : elem.getBoundingClientRect().top + y; | ||
var distance = target.nodeName.toLowerCase() === 'html' ? -y : target.getBoundingClientRect().top + y; | ||
return distance + offset; | ||
}; |
{ | ||
"name": "scroll-smooth", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
51486