Comparing version 1.5.2 to 1.5.3
{ | ||
"name": "moveto", | ||
"description": "A lightweight scroll animation javascript library without any dependency.", | ||
"main": "src/moveTo.js", | ||
"main": "dist/moveTo.js", | ||
"authors": [ | ||
@@ -6,0 +6,0 @@ "Hasan Aydoğdu <hsnaydd@gmail.com>" |
/*! | ||
* MoveTo - A lightweight scroll animation javascript library without any dependency. | ||
* Version 1.5.2 (22-03-2017 10:25) | ||
* Version 1.5.3 (24-03-2017 14:41) | ||
* Licensed under MIT | ||
@@ -138,3 +138,3 @@ * Copyright 2017 Hasan Aydoğdu <hsnaydd@gmail.com> | ||
var startTime = null; | ||
var lastPageYOffset = 0; | ||
var lastPageYOffset = void 0; | ||
@@ -146,3 +146,3 @@ // rAF loop | ||
if (!startTime) { | ||
// To starts time from 1, we subtracted -1 from current time | ||
// To starts time from 1, we subtracted 1 from current time | ||
// If time starts from 1 The first loop will not do anything, | ||
@@ -155,3 +155,3 @@ // because easing value will be zero | ||
if (lastPageYOffset !== 0) { | ||
if (lastPageYOffset) { | ||
if ( | ||
@@ -217,3 +217,3 @@ lastPageYOffset === currentPageYOffset || | ||
} else { | ||
window.moveTo = MoveTo; | ||
window.MoveTo = MoveTo; | ||
} |
/*! | ||
* MoveTo - A lightweight scroll animation javascript library without any dependency. | ||
* Version 1.5.2 (22-03-2017 10:25) | ||
* Version 1.5.3 (24-03-2017 14:41) | ||
* Licensed under MIT | ||
@@ -8,2 +8,2 @@ * Copyright 2017 Hasan Aydoğdu <hsnaydd@gmail.com> | ||
"use strict";var MoveTo=function(){function t(t,e,n,o){return t/=o,t--,-n*(t*t*t*t-1)+e}function e(t){for(var e=0,n=0;t;)e+=t.offsetTop,n+=t.offsetLeft,t=t.offsetParent;return{top:e,left:n}}function n(t,e){var n={};return Object.keys(t).forEach(function(e){n[e]=t[e]}),Object.keys(e).forEach(function(t){n[t]=e[t]}),n}function o(t){return t.replace(/([A-Z])/g,function(t){return"-"+t.toLowerCase()})}function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.options=n(a,e),this.easeFunctions=n({easeOutQuart:t},o)}function i(t,e){var n={};return Object.keys(e).forEach(function(e){var r=t.getAttribute("data-mt-"+o(e));r&&(n[e]=isNaN(r)?r:parseInt(r,10))}),n}var a={tolerance:0,duration:800,easing:"easeOutQuart",callback:function(){}};return r.prototype.registerTrigger=function(t,e){var o=this;if(t){var r=t.getAttribute("href")||t.getAttribute("data-target"),a=r&&"#"!==r?document.getElementById(r.substring(1)):0,u=n(this.options,i(t,this.options));"function"==typeof e&&(u.callback=e),t.addEventListener("click",function(t){t.preventDefault(),o.move(a,u)})}},r.prototype.move=function(t){var o=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(0===t||t){r=n(this.options,r);var i="number"==typeof t?t:e(t).top,a=window.pageYOffset;i-=r.tolerance;var u=i-a,c=null,s=0,f=function e(n){var f=window.pageYOffset;c||(c=n-1);var l=n-c;if(0!==s&&(s===f||u>0&&s>f||u<0&&s<f))return r.callback(t);s=f;var v=o.easeFunctions[r.easing](l,a,u,r.duration);window.scroll(0,v),l<r.duration?window.requestAnimationFrame(e):(window.scroll(0,i),r.callback(t))};window.requestAnimationFrame(f)}},r.prototype.addEaseFunction=function(t,e){this.easeFunctions[t]=e},r}();"undefined"!=typeof module?module.exports=MoveTo:window.moveTo=MoveTo; | ||
"use strict";var MoveTo=function(){function t(t,e,n,o){return t/=o,t--,-n*(t*t*t*t-1)+e}function e(t){for(var e=0,n=0;t;)e+=t.offsetTop,n+=t.offsetLeft,t=t.offsetParent;return{top:e,left:n}}function n(t,e){var n={};return Object.keys(t).forEach(function(e){n[e]=t[e]}),Object.keys(e).forEach(function(t){n[t]=e[t]}),n}function o(t){return t.replace(/([A-Z])/g,function(t){return"-"+t.toLowerCase()})}function r(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.options=n(a,e),this.easeFunctions=n({easeOutQuart:t},o)}function i(t,e){var n={};return Object.keys(e).forEach(function(e){var r=t.getAttribute("data-mt-"+o(e));r&&(n[e]=isNaN(r)?r:parseInt(r,10))}),n}var a={tolerance:0,duration:800,easing:"easeOutQuart",callback:function(){}};return r.prototype.registerTrigger=function(t,e){var o=this;if(t){var r=t.getAttribute("href")||t.getAttribute("data-target"),a=r&&"#"!==r?document.getElementById(r.substring(1)):0,u=n(this.options,i(t,this.options));"function"==typeof e&&(u.callback=e),t.addEventListener("click",function(t){t.preventDefault(),o.move(a,u)})}},r.prototype.move=function(t){var o=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(0===t||t){r=n(this.options,r);var i="number"==typeof t?t:e(t).top,a=window.pageYOffset;i-=r.tolerance;var u=i-a,c=null,s=void 0,f=function e(n){var f=window.pageYOffset;c||(c=n-1);var v=n-c;if(s&&(s===f||u>0&&s>f||u<0&&s<f))return r.callback(t);s=f;var d=o.easeFunctions[r.easing](v,a,u,r.duration);window.scroll(0,d),v<r.duration?window.requestAnimationFrame(e):(window.scroll(0,i),r.callback(t))};window.requestAnimationFrame(f)}},r.prototype.addEaseFunction=function(t,e){this.easeFunctions[t]=e},r}();"undefined"!=typeof module?module.exports=MoveTo:window.MoveTo=MoveTo; |
{ | ||
"name": "moveto", | ||
"version": "1.5.2", | ||
"version": "1.5.3", | ||
"description": "A lightweight scroll animation javascript library without any dependency.", | ||
"main": "src/moveTo.js", | ||
"main": "dist/moveTo.js", | ||
"scripts": { | ||
@@ -7,0 +7,0 @@ "test": "ava tests/**" |
@@ -12,3 +12,3 @@ # MoveTo [![npm version](https://badge.fury.io/js/moveto.svg)](https://badge.fury.io/js/moveto) [![Bower version](https://badge.fury.io/bo/moveTo.svg)](https://badge.fury.io/bo/moveTo) [![Build Status](https://travis-ci.org/hsnaydd/moveTo.svg?branch=master)](https://travis-ci.org/hsnaydd/moveTo.js) | ||
```sh | ||
$ npm install moveTo --save | ||
$ npm install moveto --save | ||
``` | ||
@@ -19,3 +19,3 @@ | ||
```sh | ||
$ yarn add moveTo | ||
$ yarn add moveto | ||
``` | ||
@@ -22,0 +22,0 @@ |
@@ -131,3 +131,3 @@ | ||
let startTime = null; | ||
let lastPageYOffset = 0; | ||
let lastPageYOffset; | ||
@@ -139,3 +139,3 @@ // rAF loop | ||
if (!startTime) { | ||
// To starts time from 1, we subtracted -1 from current time | ||
// To starts time from 1, we subtracted 1 from current time | ||
// If time starts from 1 The first loop will not do anything, | ||
@@ -148,3 +148,3 @@ // because easing value will be zero | ||
if (lastPageYOffset !== 0) { | ||
if (lastPageYOffset) { | ||
if ( | ||
@@ -210,3 +210,3 @@ (lastPageYOffset === currentPageYOffset) || | ||
} else { | ||
window.moveTo = MoveTo; | ||
window.MoveTo = MoveTo; | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
208814