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

Problem with element that is bigger than viewport #81

Open
shem8 opened this issue Jun 8, 2017 · 0 comments
Open

Problem with element that is bigger than viewport #81

shem8 opened this issue Jun 8, 2017 · 0 comments
Labels

Comments

@shem8
Copy link

shem8 commented Jun 8, 2017

When I have an element that is bigger that the viewport the onChange will never trigger with true.

That's because we're doing the following check:

var visibilityRect = {
      top: rect.top >= containmentRect.top,
      left: rect.left >= containmentRect.left,
      bottom: rect.bottom <= containmentRect.bottom,
      right: rect.right <= containmentRect.right
    };

So in any given moment the rect.bottom <= containmentRect.bottom && rect.top >= containmentRect.top will be true.

The solution is to change state to be some kind of enum (NONE, TOP, BOTTOM, COMPLETE), so we'll able to trigger onChange(true) when TOP && BOTTOM exists.

@joshwnj joshwnj added the bug label Jul 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants