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

emblaApi.slidesInView() should use IntersectionObserver #558

Closed
1 task done
Tracked by #321
davidjerleke opened this issue Aug 22, 2023 · 1 comment
Closed
1 task done
Tracked by #321

emblaApi.slidesInView() should use IntersectionObserver #558

davidjerleke opened this issue Aug 22, 2023 · 1 comment
Labels
feature request New feature or request resolved This issue is resolved

Comments

@davidjerleke
Copy link
Owner

davidjerleke commented Aug 22, 2023

Feature request is related to

  • embla-carousel (core package)

Is your feature request related to an issue?

  • When emblaApi.slidesInView() is called intensely on scroll, there's a performance hit.

Describe the solution you'd like

  • The current implementation for slidesInView was build for the IE11 era. I'd like to get rid of the performance hit and refactor the slidesInView code so it's using IntersectionObserver instead, now that IE11 is dead.

⚠️ The slidesInView option will be replaced with the IntersectionObserver threshold so it will accept both a single number or an array of numbers:

Setup

const options = {
  slidesInView: IntersectionObserverInit['threshold'] // Which is --> number | number[] 
}

Usage

emblaApi.on('slidesInView', (emblaApi) => {
  console.log(emblaApi.slidesInView())
})
@davidjerleke davidjerleke added the feature request New feature or request label Aug 22, 2023
@davidjerleke
Copy link
Owner Author

Released with v8.0.0-rc12.

@davidjerleke davidjerleke added the resolved This issue is resolved label Aug 22, 2023
@davidjerleke davidjerleke mentioned this issue Aug 22, 2023
37 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request resolved This issue is resolved
Projects
None yet
Development

No branches or pull requests

1 participant