I have an unordered list containing a group of photos. The navigation is set up like a filter so that if I click on X, only the photos in the X category get displayed, etc. All of the photos are initially set with the 'visible' class like this:
<ul>
<li class="visible">photo</li>
<li class="visible">photo</li>
<li class="visible">photo</li>
etc.
</ul>
When a certain filter is clicked, the photos that are not in that category get the 'visible' class removed causing them to fade out. However, while the photos get faded out, they still take up the same amount of space causing large amounts of empty space to appear.
I am trying to get rid of this empty space. My idea was to write code that says:
if
lidoes not have the 'visible' class, then hide. else, show.
Below is my attempt. However, this causes none of the photos to show up. Where have I gone wrong?
jQuery(document).ready(function($){
if (!$( '#gallery-wrap li' ).hasClass( 'visible')) {
this.hide();
} else {
this.show();
}
});