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

144
Visualizações
how to make smooth scroll?

I'm using bootstrap and this is my code. how to make smooth scroll ? Please help me

<div id="navbar-normal" class="navbar navbar-expand-lg">
        <div class="container">
            <a href="" class="navbar-brand">
                <img src="assets/images/logo.svg" alt="">
            </a>
            <div class="collapse navbar-collapse">
                <ul class="navbar-nav">
                    <li class="nav-item"><a href="#home" class="nav-link">Home</a></li>
                    <li class="nav-item"><a href="#about" class="nav-link">About</a></li>
                    <li class="nav-item"><a href="#news" class="nav-link">News</a></li>
                    <li class="nav-item"><a href="#contact" class="nav-link">Contact</a></li>
                </ul>
            </div>
        </div>
    </div>

<section id="home"><h1>Home</h1></section>
    <section id="about"><h1>About</h1></section>
    <section id="news"><h1>News</h1></section>
    <section id="contact"><h1>Contact</h1></section>
about 4 years ago · Juan Pablo Isaza
3 Respostas
Responde à pergunta

0

You don't need to use javascript to add smooth scrolling, it can be done by setting scroll-behavior: smooth; css property. Example:

html {
  scroll-behavior: smooth;
}

However that is not supported by all browsers See caniuse.com

By using a library like scroll-js, you can get scrolling working on browsers like safari.

about 4 years ago · Juan Pablo Isaza Relatório

0

It's not obvious what you mean. If you mean that you want the page to smoothly go from one anchor link to the next, use CSS scroll-behavior. If you want elements on the page to move smoothly as the user scrolls with their finger or mouse wheel, I would suggest Locomotive Scroll or similar. However, you're probably looking for the first option.

CSS scroll-behavior demo:

:root {
  scroll-behavior: smooth;
}

/* demo */
nav {
  display: block;
  height: 1rem;
  position: fixed;
}
section { 
  height: 100vh; 
  padding-top: 2rem;
}
<nav>
  <a href="#a">Go to A</a>
  <a href="#b">Go to B</a>
  <a href="#c">Go to C</a>
</nav>

<section id="a">Section A</section>
<section id="b">Section B</section>
<section id="c">Section C</section>

about 4 years ago · Juan Pablo Isaza Relatório

0

You don't need to use javascript to add smooth scrolling

in css use this

:root{
  behavior: smooth;
}
about 4 years ago · Juan Pablo Isaza Relatório
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