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

Fullscreen body scroll issue #3

Open
schellenbergk opened this issue Apr 11, 2018 · 7 comments
Open

Fullscreen body scroll issue #3

schellenbergk opened this issue Apr 11, 2018 · 7 comments
Assignees

Comments

@schellenbergk
Copy link

When in fullscreen user can scroll the body when swiping up/down on the fullscreen overlay.

@schellenbergk
Copy link
Author

Is there a way to extend fullscreen functionality to add a custom body class?

@desandro
Copy link
Member

Thanks for reporting this issue. What device / browser are you testing with? This might be related to metafizzy/flickity#740

@schellenbergk
Copy link
Author

Latest chrome on ios (iphone x). Also happens on latest safari ios.

@desandro
Copy link
Member

Okay, I'll have to take a look.

@desandro desandro self-assigned this Apr 12, 2018
@benjibee
Copy link

I'm coming across this issue now in my development. I have some slides that contain text and the user can scroll vertically to read this, or horizontally to navigate slides. Using the latest Safari and Firefox for iOS the background scrolls once the user hits the bottom of the slide.

@quangnhattran
Copy link

Hi @desandro
You have any idea on how to resolve this matter?
Thanks :)

@petercarsater
Copy link

petercarsater commented Mar 17, 2019

I used a solution suggested at stackoverflow.

$carousel.on( 'fullscreenChange.flickity', function( event, isFullscreen ) {

    if (isFullscreen) {
        
        var _overlay = document.querySelector('.flickity-enabled.is-fullscreen');
        var _clientY = null; // remember Y position on touch start

        _overlay.addEventListener('touchstart', function (event) {
            if (event.targetTouches.length === 1) {
                // detect single touch
                _clientY = event.targetTouches[0].clientY;
            }
        }, false);

        _overlay.addEventListener('touchmove', function (event) {
            if (event.targetTouches.length === 1) {
                // detect single touch
                disableRubberBand(event);
            }
        }, false);

        function disableRubberBand(event) {
            var clientY = event.targetTouches[0].clientY - _clientY;

            if (_overlay.scrollTop === 0 && clientY > 0) {
                // element is at the top of its scroll
                event.preventDefault();
            }

            if (isOverlayTotallyScrolled() && clientY < 0) {
                //element is at the top of its scroll
                event.preventDefault();
            }
        }

        function isOverlayTotallyScrolled() {
            // https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollHeight#Problems_and_solutions
            return _overlay.scrollHeight - _overlay.scrollTop <= _overlay.clientHeight;
        }

        

    }
    
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants