Snap.js icon indicating copy to clipboard operation
Snap.js copied to clipboard

Body can scroll horizontally on Android

Open kench928 opened this issue 10 years ago • 7 comments

Environment: Android 4.4.4 / Sony Xperia Z

After opening the mobile menu, you can touch on the underneath menu area and scroll horizontally (like what you see on the attchment [screenshot_2014-10-22-23-56-35]). And then after you close it, the whole screen moved left and not in the correct position (like attchement [screenshot_2014-10-23-01-27-31]).

I can't find any solution and colud someone figure it out how to fix it? Thanks a lot.

screenshot_2014-10-22-23-56-35

screenshot_2014-10-23-01-27-31

kench928 avatar Oct 22 '14 17:10 kench928

To supplement: I have same problem on Android Chrome 38.0.2125.102 and Android Firefox 33.0.

kench928 avatar Oct 22 '14 17:10 kench928

Confirm that bug. Its not only Android issue, but can be repeatable on decktop with touchscreen with Chrome 38+ 8( You can repeat this behaviour on expample page just open left-side menu and than touch menu in any point and swipe it to right... =\

brutto avatar Oct 30 '14 13:10 brutto

We're encountering a similar behaviour on iOS 7+8, too. :cry:

HalloTobi avatar Nov 06 '14 11:11 HalloTobi

I was also experiencing this and the following css appears to have resolved the issue

.snapjs-right,
.snapjs-left {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    overflow: hidden;
}

devben avatar Nov 13 '14 20:11 devben

:+1:

ashishsajwan avatar Jan 23 '15 08:01 ashishsajwan

Think @devben's solution is not really good. If you scroll down then acticate the menu, the body content jumps to top again. I solved it with following js-snippet:

this.snapper.on('animated', function() {
    if( jQuery('body').hasClass('snapjs-left') || jQuery('body').hasClass('snapjs-right') ) {
        jQuery('body').css({
            position: 'fixed',
            top: jQuery(window).scrollTop() * -1
        });
    }
    else if( jQuery('body').css('position') == 'fixed' ) {
        var top = parseFloat( jQuery('body').css('top') ) * -1;
            jQuery('body').css({
            position: '',
            top: 0
        });

        if( top != 0 ) {
            jQuery(window).scrollTop( top );
        }
    }
});

The only problem here is, that on android the page seems to get rendered again, so you have a blank page for some ms (1-10ms). Not very nice, but better than the other solution.

If someone has a better idea, just let me know :P

Ninos avatar Jun 19 '15 12:06 Ninos

Any new solution to this?

alexiovay avatar Oct 08 '17 00:10 alexiovay