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

218
Visualizações
I have side navigation and when I scroll down to pick a certain page, the navigation bar jumps to the top of the page

I have been looking for the solution here on stackoverflow, but couldn't find any correct way to solve the issue.

My issue: I have side navigation bar on the left, when i scroll down and select certain page the navigation bar jumps to the top of the navigation bar. I want navigation bar to remain on the same position when I clicked. Pls advise.

HERE IS THE CODE:

  const LayoutWithSidebar = ({ toggleSideBar, setToggleSidebar, btn }) => {
  const { t } = useTranslation();
  const handleEnterMouse = () => {
    setToggleSidebar(true);
  };
  return (
    <aside
      className={`left-sidebar-style ${
        toggleSideBar ? 'open-left-sidebar' : 'left-sidebar'
      }`}
      onMouseEnter={handleEnterMouse}
      data-sidebarbg="skin5">
      <div className="scroll-sidebar">
        <UserProfile btn={btn} toggleSideBar={toggleSideBar} translation={t} />
        <SidebarLinks btn={btn} toggleSideBar={toggleSideBar} translation={t} />
      </div>
      {(toggleSideBar || btn) && <SidebarFooter />}
      <style jsx toggleSideBar={toggleSideBar}>
        {Styles}
      </style>
    </aside>
  );
};

export default LayoutWithSidebar;

SideBarLinks.js file

const SidebarLinks = (props) => {
  return (
    <nav className="sidebar-nav fixed">
      <ul id="sidebarnav" className="in">
        {navItems.map((navItem) => (
          <SidebarItem key={navItem.transKey} {...navItem} {...props} />
        ))}
      </ul>
    </nav>
  );
};

export default SidebarLinks;

Thank you.

about 4 years ago · Santiago Gelvez
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