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

170
Vistas
Hide Div on Scroll

I have this Div that shows up on button click and then lies over some other content, where the button to show the content lies too. I want to hide this div again by scrolling. I have some code which works, but only with limitations which makes it unusable.

I tried the following code:

  $(window).scroll(function() {
  if ($(this).scrollTop() > 100) {
    $('.hidden-content').fadeOut();
  }
});

This actually works but here is the problem: The button I use to show the content does not work anymore while hover-animations in this div still works everywhere. So I do not think this is a problem about a hidden div with a high z-Index value what lies above of everything.

I also tried the following code based on some help of the user Ned Hulton for hiding this div on a button click which worked perfectly fine, but I didn't get the translation for the scroll event right as it seems.

$(window).scroll(function() {
   if ($(this).scrollTop() > 100) {
        $('.hidden-content').animate({"opacity":"0"}, function(){
        $(this).css({"zIndex":"-1"})
});
});

And maybe it will also help if I show you the code to make the div appear by a click on a button:

$('.clickable-content').click(function(e) {
      $('.hidden-content').css({
        "opacity":"1",
        "z-index": "9"
        });
    });

Hope someone can help me out! Thak you for reading!

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