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

Viewport issue on slider #567

Open
zborkala opened this issue Dec 27, 2023 · 0 comments
Open

Viewport issue on slider #567

zborkala opened this issue Dec 27, 2023 · 0 comments

Comments

@zborkala
Copy link

zborkala commented Dec 27, 2023

before_changes.1.mp4

Replacing the following lines in isElementVisible() function solves the problem of viewport issue on slider.

function isElementVisible(element) {
    ...
    var elementRect = element.node.getBoundingClientRect();
    var geoBounds = element.geometry.bounds;
    var highestBound = {
        left: Math.min(elementRect.left, geoBounds.left),
        right: Math.max(elementRect.right, geoBounds.right),
        top: Math.max(elementRect.top, geoBounds.top),
        bottom: Math.max(elementRect.bottom, geoBounds.bottom),
    }


    var elementBounds = {
        top: highestBound.top + element.geometry.height * viewFactor,
        right: highestBound.right - element.geometry.width * viewFactor,
        bottom: highestBound.bottom - element.geometry.height * viewFactor,
        left: highestBound.left + element.geometry.width * viewFactor
    };
    ....
}
after_changes.1.mp4

But, you have to call ScrollReveal().delegate() function on the corresponding event listeners. Because ScrollReveal.js only works on scroll and resize event.

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

1 participant