-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
12 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <[email protected]>" | ||
], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <[email protected]> | ||
*/ | ||
|
@@ -135,22 +135,22 @@ 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; | ||
} | ||
|
||
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; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters