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

Make element visiblity check configurable #104

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gajus
Copy link

@gajus gajus commented Aug 1, 2016

Adds two configurations:

  • checkHorizontalElementVisibility (defaults to true) – toggles check of horizontal element visibility check.
  • checkVerticalElementVisibility (defaults to true) – toggles check of vertical element visibility check.

The primary use case

  • Websites that rely on horizontal navigation.
  • Web components that contain animated content (using setInterval), such as the carousel.

Example use case

Website contains a carousel element. Images in the carousel are using lazy loading. Carousel transitions (loading new content) are controlled using setInterval. In such case, simply adding scroll or re-indexing the images on the page upon click event is not enough – it would require running re-indexing multiple times. A simple solution is to disable horizontal visibility check (thus the hidden content in the carousel will be loaded as soon as carousel scrolls into the view).

@gajus
Copy link
Author

gajus commented Aug 1, 2016

In relation to #103

@dinbror
Copy link
Owner

dinbror commented Sep 2, 2016

Hey @gajus

Sorry for the late reply. Thanks for the PR.
Normally with carousels I'm using the public ´load´ function to load what slides into the view. Wouldn't that also solve your issue?

@idoshamun
Copy link

I find this PR very useful for my use cases as well.
Sometimes I animate elements horizontal from outside the viewport to inside.
I want the images to be loaded already when animating in

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

Successfully merging this pull request may close these issues.

3 participants