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

Update jquery.visible.js - dealing with elements larger than window height #16

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

Conversation

danielszanto
Copy link

If the element is larger than the window it will register as not visible when edges are off screen. To fix this I added checks if element top is above screen top && element bottom is below screen bottom.

The non-native method is rather ugly

If the element is larger than the window it will register as not visible when edges are off screen. To fix this I added checks if element top is above screen top && element bottom is below screen bottom.

The non-native method is rather ugly
hVisible = partial ? lViz || lViz : lViz && rViz;
hmVis= rec.left < 0 && rec.right > vpWidth,
vVisible = partial ? tViz || bViz || mVis : tViz && bViz,
hVisible = partial ? lViz || lViz ||hmVis : lViz && rViz;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 I just made this same change in my local clone. Didn't have to look at the non native implementation because I don't have to support browsers without getBoundingClientRect :)

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.

2 participants