Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix for container calculations #38

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions lib/angular-smooth-scroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
do {
location += element.offsetTop;
element = element.offsetParent;
} while (element);
} while (element && element !== container);
}
location = Math.max(location - offset, 0);
return location;
Expand Down Expand Up @@ -120,14 +120,15 @@

if (
( // condition 1
position == endLocation
) ||
Math.abs(position - endLocation) < 0.001
) ||
( // condition 2
currentLocation == endLocation
Math.abs(currentLocation - endLocation) < 0.001
) ||
( // condition 3
internalHeight >= scrollHeight
)
!containerPresent &&
internalHeight >= scrollHeight
)
) { // stop
clearInterval(runAnimation);
callbackAfter(element);
Expand Down
28 changes: 28 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "ng-smooth-scroll",
"version": "2.0.0",
"description": "A pure-javascript library and set of directives to scroll smoothly to an element with easing.",
"main": "lib/angular-smooth-scroll.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/d-oliveros/ngSmoothScroll.git"
},
"keywords": [
"angularjs",
"smooth scroll",
"scrolling",
"scroll effects",
"scroll animations",
"smooth",
"scroll"
],
"author": "David Oliveros <[email protected]>",
"license": "MIT",
"bugs": {
"url": "https://github.com/d-oliveros/ngSmoothScroll/issues"
},
"homepage": "https://github.com/d-oliveros/ngSmoothScroll#readme"
}