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

168
Visualizações
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 à 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