Skip to content

Commit ed47881

Browse files
committed
Release 1.1.1
1 parent 1a6ccd0 commit ed47881

File tree

4 files changed

+23
-12
lines changed

4 files changed

+23
-12
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ngInfiniteScroll",
3-
"version": "1.1.0",
3+
"version": "1.1.1",
44
"main": "build/ng-infinite-scroll.js",
55
"dependencies": {
66
"angular": ">=1.1.3"

build/ng-infinite-scroll.js

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* ng-infinite-scroll - v1.1.0 - 2014-04-03 */
1+
/* ng-infinite-scroll - v1.1.1 - 2014-05-14 */
22
var mod;
33

44
mod = angular.module('infinite-scroll', []);
@@ -23,20 +23,31 @@ mod.directive('infiniteScroll', [
2323
container = null;
2424
immediateCheck = true;
2525
handler = function() {
26-
var containerBottom, elementBottom, remaining, shouldScroll;
26+
var containerBottom, containerTopOffset, elementBottom, remaining, shouldScroll;
2727
if (container === $window) {
2828
containerBottom = container.height() + container.scrollTop();
2929
elementBottom = elem.offset().top + elem.height();
3030
} else {
3131
containerBottom = container.height();
32-
elementBottom = elem.offset().top - container.offset().top + elem.height();
32+
containerTopOffset = 0;
33+
if (container.offset() !== void 0) {
34+
containerTopOffset = container.offset().top;
35+
}
36+
elementBottom = elem.offset().top - containerTopOffset + elem.height();
3337
}
3438
remaining = elementBottom - containerBottom;
3539
shouldScroll = remaining <= container.height() * scrollDistance + 1;
36-
if (shouldScroll && scrollEnabled) {
37-
return scope.infiniteScroll();
38-
} else if (shouldScroll) {
39-
return checkWhenEnabled = true;
40+
if (shouldScroll) {
41+
checkWhenEnabled = true;
42+
if (scrollEnabled) {
43+
if (scope.$$phase || $rootScope.$$phase) {
44+
return scope.infiniteScroll();
45+
} else {
46+
return scope.$apply(scope.infiniteScroll);
47+
}
48+
}
49+
} else {
50+
return checkWhenEnabled = false;
4051
}
4152
};
4253
throttle = function(func, wait) {
@@ -92,7 +103,7 @@ mod.directive('infiniteScroll', [
92103
if (container != null) {
93104
container.off('scroll', handler);
94105
}
95-
container = newContainer;
106+
container = typeof newContainer.last === 'function' ? newContainer.last() : newContainer;
96107
if (newContainer != null) {
97108
return container.on('scroll', handler);
98109
}

build/ng-infinite-scroll.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ng-infinite-scroll",
3-
"version": "1.1.0",
3+
"version": "1.1.1",
44
"description": "Infinite scrolling for AngularJS",
55
"repository": {
66
"type": "git",

0 commit comments

Comments
 (0)