0

I have an ng-repeat that loads posts from a firebase database. I load the items in reverse so as new posts are made, they appear at the top of the list (similar to Facebook). I have been able to maintain scroll position for the user if a new item is added to the top, however, when a post is deleted, I cannot seem to keep the post the user was looking at in view. The div will shift the content to fill the voided space. Is there an elegant solution to this problem? I am able to accomplish this if each post was the same height, however, different posts are different heights.

I maintain scroll when adding a post through most likely a sloppy method. In the ng-repeat, I add a class "first". Using arrivejs, when a new ".first" element is loaded, I calculate the posts height and the scrollTop of the container and just do some math.

Any suggestions are greatly appreciated.

prozac
  • 239
  • 2
  • 5
  • Suggestion: Take inspiration from Twitter. They do not add new tweets when you are reading the stream, they only show small message that says "Show X new tweets". Then you would not need to handle any scrolling, user would click "show new items" when he is ready to read them – David Votrubec Feb 25 '15 at 08:18
  • Thank you for your suggestion. Sorry for the late reply! I did in fact use it :) – prozac May 10 '15 at 20:39
  • then please mark this question as answered – David Votrubec May 13 '15 at 05:54

0 Answers0