Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

213
Visualizações
window.screenY in mobile devices is always zero on Webkit (Chrome, Safari) but works on Gecko (Firefox)

Problem

window.screenY always returns 0 on Safari and Chrome (Android and iOS).

I need to know the vertical position of the viewport in compare to the screen, on mobile devices, in browser.

Per MDN, Window.screenY should return it. It works fine on Firefox, but not on Chrome (Android or iOS) or Safari (iOS). I filed a bug on WebKit (https://bugs.webkit.org/show_bug.cgi?id=234256), but I wanted to see if anyone else has faced this or has any solution.

Hacky partial solution

I can get this by subtracting clientY from screenY on a touch/click event. But I want this is general.

Original problem

I have an element that I want to attach to the bottom of the window, but not all the way to the bottom of the screen. i.e. on Android's 3-button menus, the padding that gives to the bottom of the screen is great. However, with the Gesture Navigation on android, there is no bottom padding padding between the window and the screen.

enter image description here

I found no way to detect whether the use has "3-button Navigation buttons" or "Gestures Navigation". I am hoping to guess that by subtracting the screenY from window.screen.availHeight - window.innerHeight to get the equivalent of screenY for the bottom. (bottom padding between the window and the screen.)

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda