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

Support rootMargin on intersectionObserver #13

Closed
ScriptedAlchemy opened this issue Apr 8, 2020 · 8 comments
Closed

Support rootMargin on intersectionObserver #13

ScriptedAlchemy opened this issue Apr 8, 2020 · 8 comments

Comments

@ScriptedAlchemy
Copy link
Collaborator

Some components can load in a janky fashion if they are hydrated when directly in view.

Id like to propose the ability to add a rootMargin, allowing a component to hydrate itself before a user is fully viewing it.

Use case:

  • carousels where additional computation is required after mounting
  • components that use fade-in effects or lazyloading images does not have a smooth experience
  • components that use intersection observer themselves

Reasoning

Would provide a better UX

@hadeeb
Copy link
Owner

hadeeb commented Apr 9, 2020

This is interesting.

I am not that familiar with intersection observers to think of a possible solution. Interested to know if you have anything cooking up.

Also, I feel it might be a bit difficult to add more configuration to the component in it's current form.

@ScriptedAlchemy
Copy link
Collaborator Author

I can open a PR and just hard code a default margin of like 100px if that’s okay.

@hadeeb
Copy link
Owner

hadeeb commented Apr 9, 2020

Yes, that would be awesome.

@ScriptedAlchemy
Copy link
Collaborator Author

PR open, I'm also open to helping you maintain this project if you're interested. It works better than any of the others out there. Might throw a few more PR's your way

@hadeeb
Copy link
Owner

hadeeb commented Apr 10, 2020

@ScriptedAlchemy I have added you as a collaborator.

@ScriptedAlchemy
Copy link
Collaborator Author

@hadeeb i see you merged my PR, can you push the latest to NPM?

@szepgergo
Copy link

Hello,
Just saw the PR and was wondering... would it be possible to expose the rootMargin as an optional property with the default of '250px' instead of just hardcoding it in the module? Thank you

@szepgergo
Copy link

I've tried to make it myself. Please note, I'm not very familiar with TS: #29

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

No branches or pull requests

3 participants