Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Not a top of the page but window.scrollY equals 0 on chrome mobile browser

Not a top of the page but window.scrollY equals 0 on chrome mobile browser.

enter image description here

like image 942
Алексей Титов Avatar asked Sep 01 '25 03:09

Алексей Титов


2 Answers

This is a late answer but this problem is still a recurrent one... For some obscure reason, Chrome on Android requires that you set "minimum-scale=1" in the "viewport" meta of your page. Not doing so causes the scrollY value to start increasing only after a good portion of the page is already scrolled (I'm assuming this is because without this setting, the viewport's height is somehow considered larger than the screen's height).

<meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1">
like image 182
Bruno Lalande Avatar answered Sep 02 '25 15:09

Bruno Lalande


I have fixed wrong scroll computations by the following css rule on mobile chrome

@media screen and (max-width: @screen-sm-max) {
    html, body {
        overflow: auto !important;
    }
}
like image 44
Алексей Титов Avatar answered Sep 02 '25 17:09

Алексей Титов