diff --git a/bower.json b/bower.json index 4291e64..7544fce 100644 --- a/bower.json +++ b/bower.json @@ -1,7 +1,7 @@ { "name": "moveto", "description": "A lightweight scroll animation javascript library without any dependency.", - "main": "src/moveTo.js", + "main": "dist/moveTo.js", "authors": [ "Hasan Aydoğdu " ], diff --git a/dist/moveTo.js b/dist/moveTo.js index dcb8c58..e872bd6 100644 --- a/dist/moveTo.js +++ b/dist/moveTo.js @@ -1,6 +1,6 @@ /*! * 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 * Copyright 2017 Hasan Aydoğdu */ @@ -135,14 +135,14 @@ var MoveTo = function () { to -= options.tolerance; var change = to - from; var startTime = null; - var lastPageYOffset = 0; + var lastPageYOffset = void 0; // rAF loop var loop = function loop(currentTime) { var currentPageYOffset = window.pageYOffset; 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, // because easing value will be zero startTime = currentTime - 1; @@ -150,7 +150,7 @@ var MoveTo = function () { var timeElapsed = currentTime - startTime; - if (lastPageYOffset !== 0) { + if (lastPageYOffset) { if ( lastPageYOffset === currentPageYOffset || change > 0 && lastPageYOffset > currentPageYOffset || @@ -211,5 +211,5 @@ var MoveTo = function () { if (typeof module !== 'undefined') { module.exports = MoveTo; } else { - window.moveTo = MoveTo; + window.MoveTo = MoveTo; } \ No newline at end of file diff --git a/dist/moveTo.min.js b/dist/moveTo.min.js index 564f752..8b4940e 100644 --- a/dist/moveTo.min.js +++ b/dist/moveTo.min.js @@ -1,8 +1,8 @@ /*! * 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 * Copyright 2017 Hasan Aydoğdu */ -"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&&s0&&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 { to -= options.tolerance; const change = to - from; let startTime = null; - let lastPageYOffset = 0; + let lastPageYOffset; // rAF loop const loop = (currentTime) => { @@ -204,5 +204,5 @@ const MoveTo = (() => { if (typeof module !== 'undefined') { module.exports = MoveTo; } else { - window.moveTo = MoveTo; + window.MoveTo = MoveTo; }