Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

65
Vistas
Issue with button not working when scrolling up

I have a hamburger button that sticks to the top right corner of the page as you scroll down the page. When clicked, the hamburger button displays a nav menu. However, if I scroll up on the page the hamburger button functionality does not work. In my code, the hamburger button is named "menuBtn" and the sticky class that is added in the code just makes the position of the button fixed. I have attached my JavaScript code because I believe this is the problem.

const hamburgerMenu = document.querySelector('.hamburger__anchors--bin');
const menuBtn = document.querySelector('.menu-btn');
//sticky hamburger btn 
window.onscroll = function() {
    if(window.pageYOffset >= menuBtn.offsetTop) {
        menuBtn.classList.add('sticky')
        hamburgerMenu.classList.toggle('stickytwo');
    } else {
        menuBtn.classList.remove('sticky')

    }
}
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda