-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
Multiple scroll components with windowViewport #347
Comments
If i could access "Workflow" that would be fine too i think. So i could just deregister/register the onScroll event |
@muchbetterug Okay, there are two options I see, that don't require any updates on the lib side.
If we want to solve the issue on the scroller's end, we may consider the following options.
What do you think? |
Big thx!
I think 3. is ideal, as this wouldnt include touching the core. In the Routines.onScroll i can check, if a specific ui-scroll should process the scroll event. Or override temporaly a specific routine.onScroll to a noop function, if i want the ui-scroll to be inactive So the main problem is, multiple ui-scrolls thats listen to window onscroll events. I cannot work with *ngIf, cause the ui-scrollers needs to stay initialized. With the change in 3. i think i can solve this problem. Thx, really! |
@muchbetterug Okay, I started implementing p3 in PR #350. Actually, p4 approach also seems very useful, maybe I'll do both, let's see. |
ngx-ui-scroll v3.2.0-beta is available on npm. This release provides Routines experimental API. Details and example can be taken from the demo: https://dhilt.github.io/ngx-ui-scroll/#/experimental#routines. Speaking of your case with pausing scroll event processing, I would expect you to write something like the following: onScroll(handler) {
const myHandler = event => {
if (context.stop) { // see demo to get the consumer's context
return;
}
handler(event);
};
// below is a tweaked replica of the original Routines.onScroll implementation, see sources
const eventReceiver = this.settings.window ? window : this.viewport;
eventReceiver.addEventListener('scroll', myHandler);
return () => eventReceiver.removeEventListener('scroll', myHandler);
} |
sorry for the late reply, this change works fantastically and is fearly simple, super! i wish you all the best!! |
Hey!
Is there a way, to pause a scroller, especially the scroll subscription when windowViewport is true?
I have multiple pages, which doesnt get destroyed, but are holded in the back (through a custom route strategy).
So i can easily jump between different pages and maintain the scroll positions (without flicker). Thats working great.
I use windowViewport, cause i want the url adress bar to hide on scroll.
So, when i switch pages, the scroll subscriptions doesnt get paused, hence the scroller doesnt even know, whether it should be paused. So there are multiple scroll logs, and if i switch to often, the buffer gets broken (i think, its cause of multiple scrollers on window)
Ideally for me would be a function: datasource.adapter.pause() and datasource.adapter.resume() or similar.
Is this possible?
I wish a great week! :-)
The text was updated successfully, but these errors were encountered: