I'm currently working on a website where clicking on an image opens up information about a person in a div. I'm achieving this using toggleClass in jQuery UI. My goal is to close any open div when another one is clicked. I tried using the :not selector like this;
$('.teamMember').click(
function(){
$('.teamMemberContent:not.teamInactive').addClass('.teamInactive');
var teamMemberID = $(this).attr('data-teamMember');
$('#'+teamMemberID).toggleClass('teamInactive');
});
However, I am not sure if I am using the :not correctly in this context. Any guidance would be highly appreciated.
Here is a snippet of my HTML code;
<div class="teamWrapper">
<div id="teamHeader">
<h1>Meet Our Team</h1>
</div>
<div class="teamMember" data-teamMember="teamDavidContent">
<div class="teamImageWrapper">
<img src="images/team/dave.jpg">
</div>
<div class="teamMemberName">
<h3>Name</h3>
<h3>Big Shot</h3>
</div>
</div>
<!-- Rest of the team member sections here -->
</div>
Shown above is just a portion of the full HTML structure. The complete code can be accessed using the provided JSFiddle link for better understanding.
Please feel free to provide any insights or assistance with implementing the desired functionality. Thank you!