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

150
Visualizações
How to make a smooth scroll animation onclick on IOS devices?

I am building a footer and of the options of the footer is "home" and when it's clicked it should scroll smoothly up and that works on my pc, but what I noticed is that it doesn't work on IOS devices. I read that the css line: HTML{ scroll-behavior: smooth;} does not work on IOS devices
<!--html code<a class="link-1" onclick="test()" href="#">Home</a>
I read a lot of the forms here on Stack Overflow. I tried a lot of thing such as:

  window.scrollTo({ top: 900, behavior: 'smooth' })
}

or using css

    overflow:scroll
-webkit-overflow-scrolling: touch;

or

document.querySelectorAll('a[href^="#"]').forEach(anchor => {
    anchor.addEventListener('click', function (e) {
        e.preventDefault();

        document.querySelector(this.getAttribute('href')).scrollIntoView({
            behavior: 'smooth'
        });
    });
});

But nothing worked. It just jumps to the top. I'm slowly running out of ideas.
Any ideas? Thanks!

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