I have a webpage that contains a lot of information, and I would like to make it easier for the user to show/hide specific parts by clicking on buttons. Check out this stackblitz to see what I've done. Here's a brief summary of the code:
<button [className]="liTrucVisibility" (click)="changeTrucVisibility($event)">part 1</button>
<div>
<p>...</p>
</div>
<button [className]="liFonctionnalityVisibility" (click)="changeFonctionnalityVisibility($event)">part 2</button>
<div>
<h1>another section</h1>
<p>...</p>
</div>
It seems like part1 is always clickable, enabling the user to show or hide the following div
. However, part2 is only clickable if the div
of part1 is visible. This behavior is unexpected to me, and I'm unsure why it's happening.
My first question: Can someone explain to me what's causing this behavior?
My second question: What adjustments do I need to make to achieve the desired functionality?
Thank you in advance for your assistance.