Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3356644
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:32:15+00:00 2026-05-18T02:32:15+00:00

Nettus+ has this nice jQuery code to filter out and show specific <li> s

  • 0

Nettus+ has this nice jQuery code to filter out and show specific <li>s from a <ul> when a category is clicked. For example, when the ‘design’ link is clicked, only the ‘design’ <li>s are shown and the rest of the portfolio <li>s are hidden. However, when I combine it with a lightbox like Yoxview (image viewer jQuery plugin), the lightbox shows the <li>s from entire portfolio instead of just showing the specific category that was clicked on and filtered out.

How can I get the the lightbox to show only the <li>s that are currently shown on the page and ignore the hidden <li>s? Thanks for any help.

    $(document).ready(function() {
    $('ul#filter a').click(function() {
        $(this).css('outline','none');
        $('ul#filter .current').removeClass('current');
        $(this).parent().addClass('current');

        var filterVal = $(this).text().toLowerCase().replace(' ','-');

        if(filterVal == 'all') {
            $('ul#portfolio li.hidden').fadeIn('slow').removeClass('hidden');
        } else {
            $('ul#portfolio li').each(function() {
                if(!$(this).hasClass(filterVal)) {
                    $(this).fadeOut('normal').addClass('hidden');
                } else {
                    $(this).fadeIn('slow').removeClass('hidden');
                }
            });
        }

        return false;
    });
});


<ul id="filter">  
     <li class="current"><a href="#">All</a></li>  
     <li><a href="#">Design</a></li>  
     <li><a href="#">Development</a></li>  
     <li><a href="#">CMS</a></li>  
     <li><a href="#">Integration</a></li>  
</ul>  

<ul id="portfolio">  
     <li class="cms integration">  
         <a href="#"><img src="images/a-list-apart.png" />A List Apart</a>  
     </li>  
     <li class="integration design">  
         <a href="#"><img src="images/apple.png" />Apple</a>  
     </li>  
     <li class="design development">  
         <a href="#"><img src="images/cnn.png" />CNN</a>  
     </li>  
     <li class="cms">  
         <a href="#"><img src="images/digg.png" />Digg</a>  
     </li>  
     <li class="design cms integration">  
         <a href="#"><img src="images/espn.png" />ESPN</a>  
     </li>  
</ul>  
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T02:32:16+00:00Added an answer on May 18, 2026 at 2:32 am

    How can I get the the lightbox to show
    only the <li>s that are currently
    shown on the page and ignore the
    hidden <li>s?

    You can use the :visible filter selector that will only affect the elements that are visible something like this:

    $('#ul_id li:visible')
    

    The above selector will work only on those lis that are inside the parent element with id ul_id and are visible.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I found a tutorial from nettuts and it has a source code in it
After I watched this NetTUTs video , I'm very interested in trying out the
I found this snippet when i was looking at jQuery plugins and wonder what
I have used the scroll bar which is extracted from this site http://jscrollpane.kelvinluck.com/arrow_hover.html .
I have a jquery problem, I'm a beginner at this! I want to apply
I am following a tutorial from nettuts, specifically here: http://blog.themeforest.net/tutorials/jquery-for-absolute-beginners-day-11/ I am 3/4's of
EDIT - 'carrierwave' doesn't work with Sinatra 1.3. Sinatra 1.2.7 rocks this code! I'm
I've never seen this done, but i get a feeling that there's gotta be
Hello i have this grid working fine here: http://tourscript.com/jqueryasp/default2.asp i start adding a pagination
I'm on windows and I want to create a web-based code snippet tool for

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.