I'm not seeing how this can be done without JavaScript. The closest is to use :active
but it only works when the mouse is pressed:
.collapse {
height: 0px;
overflow: hidden;
transition: height 0.8s;
}
h4:active + .collapse {
height: 200px;
}
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
<h4><a href="#col3Content" data-toggle="collapse">Faz um clique longo...</a></h4>
<div id="col3Content" class="collapse">Bacon ipsum dolor amet pancetta fatback ground round, bresaola strip steak boudin filet mignon turkey kevin drumstick sirloin swine pork belly. Corned beef shankle ham hock drumstick capicola short loin ball tip tri-tip kevin turkey chuck pork belly venison bacon. Fatback turkey swine tongue, chuck jerky doner pork belly pork corned beef rump leberkas. Ham hock fatback bresaola tri-tip salami.</div>
</div>
To do this without JavaScript you can use the checkbox
trick, which basically uses the adjacent sibling
logic in the CSS I mentioned above but using the status of checkbox
as a switch:
label input[type="checkbox"] {
display: none;
}
label h4 {
cursor: pointer;
text-decoration: underline;
}
.collapse {
height: 0px;
overflow: hidden;
transition: height 0.8s;
}
input:checked + .collapse {
height: 200px;
}
<div class="col-lg-6 col-md-6 col-sm-12 col-xs-12">
<label>
<h4>Clica aqui</h4>
<input type="checkbox" />
<div id="col3Content" class="collapse">Bacon ipsum dolor amet pancetta fatback ground round, bresaola strip steak boudin filet mignon turkey kevin drumstick sirloin swine pork belly. Corned beef shankle ham hock drumstick capicola short loin ball tip tri-tip kevin turkey chuck pork
belly venison bacon. Fatback turkey swine tongue, chuck jerky doner pork belly pork corned beef rump leberkas. Ham hock fatback bresaola tri-tip salami.</div>
</label>
</div>
There's even new technology in HTML5 that does this, without JavaScript or CSS, using the elements <details>
and <summary>
:
<details>
<summary>Clica aqui...</summary>
<div id="col3Content" class="collapse">Bacon ipsum dolor amet pancetta fatback ground round, bresaola strip steak boudin filet mignon turkey kevin drumstick sirloin swine pork belly. Corned beef shankle ham hock drumstick capicola short loin ball tip tri-tip kevin turkey chuck pork belly
venison bacon. Fatback turkey swine tongue, chuck jerky doner pork belly pork corned beef rump leberkas. Ham hock fatback bresaola tri-tip salami.</div>
</details>