How do I set a function to perform only when clicking the aleady active tab?

How do I set a function to perform only when clicking the aleady active tab?

I'm trying to have the active tab serve as a button to close the content. 

So Users can open and switch between the different tabs. However, if the User clicks the current active tab, then it will perform a function.

My best effort is this;
http://jsfiddle.net/noyhadar/np8p2oy0/31/

Which only recognized the first tab, as the mechanism I need. 


Noy Hadar