I've previously asked a similar question to this, the answers of which partially solved my issue.
However now I need to expand on the code.
This code toggles the visibility of the divs when there are only two, but when adding a third, it shows both the second and third sets of divs together when I want to show each set individually'
This fiddle shows what currently happens; http://jsfiddle.net/richarde/vCjPL/
jQuery
$('.media-thumb a').click(function(){
$('div[class^="media"]').toggleClass('is-hidden');
return false;
});
Markup (the click event is bound to anchor of these divs)
<div class="media-thumb ">
<img src="thumb.jpg" />
<p><a href="#">Link 1</a></p>
</div>
<div class="media-thumb is-hidden">
<img src="thumb.jpg" />
<p><a href="#">Link 2</a></p>
</div>
<div class="media-thumb is-hidden">
<img src="thumb.jpg" />
<p><a href="#">Link 3</a></p>
</div>
Now I need to expand on the above and I'm not sure my current approach is the best. What could I do to make this work in my situation?
Thanks in advance.