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

Allows to bind "reach top" callback. #174

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

evgd
Copy link

@evgd evgd commented Mar 13, 2015

Could be considered as pre requirements for #146
DOESN'T:

  1. autoscroll bottom on load
  2. preserve scroll position after prepending new items.

Could be considered as pre requirements for sroze#146.
@williamboman
Copy link

+1

@boushley
Copy link

boushley commented May 1, 2015

Do you have an example of this functional anywhere that is publicly accessible?

@williamboman
Copy link

@boushley Facebook chat.

edit: Maybe I misunderstood you, you might've meant this specific PR?

@boushley
Copy link

boushley commented May 1, 2015

Facebook chat is using react js isn't it? I'm not asking for an example of the concept in action. I'm asking for an example of this pull request being used, or a demo of this code.

The scroll top stuff appears to only work when infinite-scroll-container is set, otherwise you get a NaN so I'm trying to see what the setup for this looks like.

@@ -49,7 +52,7 @@ mod.directive('infiniteScroll', [
}
};
handler = function() {
var containerBottom, containerTopOffset, elementBottom, remaining, shouldScroll;
var containerBottom, containerTopOffset, elementBottom, remaining, remainingTop, shouldScroll, shouldScrollTop;
if (container === windowElement) {
containerBottom = height(container) + pageYOffset(container[0].document.documentElement);
elementBottom = offsetTop(elem) + height(elem);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you add containerTopOffset = container.scrollTop(); then this works against the window container as well.

@evgd
Copy link
Author

evgd commented May 4, 2015

Check this http://jsbin.com/xemeletuwi/1/edit?html,js,console,output but this is quite buggy. When I tested it I found out that there is no way to get height before and after prepend items without timeout because my example uses ng-repeat. The solution relies on digest cycle which is slow and you could see that even if you set timeout to small value it shows UI in previous state.
Maybe someone could help with this examples to make them more usable.
Btw I found https://github.com/angular-ui/ui-utils/blob/master/modules/scroll/README.md scroll component of ui-utils which implements custom repeater and supports two directions scroll with virtual scroll.

@evgd
Copy link
Author

evgd commented May 5, 2015

http://jsbin.com/qoqahijene/3/edit
this one works with ng-repeat $first/$last hack but timeout value should be big enough to get new scroll height. Couldn't figure out way to get notified when ngRepeat finished and DOM updated.

evgd added 3 commits May 8, 2015 13:44
extended with shouldScrollTop = false
fix for top handler when container not visible
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants