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

349
Visualizações
How to toggle div properties by clicking it?

I want to make a window that expands when clicked and closes when clicked again. I am using flask to display all lines of data but that should not be a problem and can actually be ignored. Right now I have it set that when you click the div it expands but once you let go the div closes again. Is there any way I can turn this div into a toggle of some kind many using python or javascript or even CSS?

HTML/Python flask:

<div class="container">
  {%for i, value in verb_data.items() %}
  <div class="indevidual_verbs">{{ i }} . {{ value }}</div><br>
  {%endfor%}
</div>

CSS:

.indevidual_verbs {
    cursor: pointer;
}

.indevidual_verbs:active {
    padding-bottom: 300px;
}
about 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

Depending on what you want to do, you could even use the details html element, that automatically implements that functionality.

If you can use javascript, there is a way to easily toggle a class:

// Get a reference to the container
const container = document.getElementById("container");

// When we click on the container...
container.addEventListener("click", function (e) {
  // we can toggle the "open" class
  this.classList.toggle("open");
});
/* Just a way to show the container */
#container {
  padding: 20px;
  border: solid 1px #000;
}

/* Hide the content (you can do it in many different ways) */
#container .inner {
  display: none;
 }
 
/* Show the content when the "open" class is added to the container */
#container.open .inner {
  display: block;
}
<div id="container">
  <div class="inner">
    This is just some example text
  </div>
</div>

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