Thanks for building the ng-scrollbar. I am using it in a situation where <li> items are being appended to an <ul> every second.This means I have to rebuild every second and also need to keep focus on the bottom. I have found some issues with this. For one I can offer a solution of sorts.
Issue 1: ng-scrollbar loses the bottom directive setting after the first build because flags.bottom is being set to false. This was for good reason because if we keep flags.bottom set to true, it could be that a user who's scrolled to a certain point gets scrolled to the bottom on a subsequent rebuild. I have added a flag called flags.keepAtBottom. In the rebuild function I have included some lines around line 237 like this:
The result is that when the scrollbar is right at the bottom and the content is being appended, it keeps focus on the bottom. If the scrollbar is not at the bottom, the behaviour is as normal. I can see some cases where this might not be desirable, but in my case it helps. Do with it what you like.
Issue 2: When the content is being appended and the scrollbar is being redrawn (not at the bottom). The content 'moves' upwards. When using a native scrollbar, a <li> item stays exactly in the same spot, the dragbar shrinks, and the area below the dragbar grows while more and more list items are being added. With ng-scrollbar I see the <li> item slowly moving up. I couldn't really figure out how to fix this...
Thanks again for building ng-scrollbar. I hope my input above helps.
Hi,
Thanks for building the ng-scrollbar. I am using it in a situation where
<li>
items are being appended to an<ul>
every second.This means I have to rebuild every second and also need to keep focus on the bottom. I have found some issues with this. For one I can offer a solution of sorts.Issue 1: ng-scrollbar loses the bottom directive setting after the first build because flags.bottom is being set to false. This was for good reason because if we keep flags.bottom set to true, it could be that a user who's scrolled to a certain point gets scrolled to the bottom on a subsequent rebuild. I have added a flag called
flags.keepAtBottom
. In therebuild
function I have included some lines around line 237 like this:And then in the buildScrollbar around line 208 I added another clause to set
dragger.top
:The result is that when the scrollbar is right at the bottom and the content is being appended, it keeps focus on the bottom. If the scrollbar is not at the bottom, the behaviour is as normal. I can see some cases where this might not be desirable, but in my case it helps. Do with it what you like.
Issue 2: When the content is being appended and the scrollbar is being redrawn (not at the bottom). The content 'moves' upwards. When using a native scrollbar, a
<li>
item stays exactly in the same spot, the dragbar shrinks, and the area below the dragbar grows while more and more list items are being added. With ng-scrollbar I see the<li>
item slowly moving up. I couldn't really figure out how to fix this...Thanks again for building ng-scrollbar. I hope my input above helps.
Regards, Hendrik