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

  • SEARCH
  • Home
  • 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 621691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:54:12+00:00 2026-05-13T18:54:12+00:00

Problem demo is here: http://www.studioimbrue.com Currently, when the page loads, all the thumbnails are

  • 0

Problem demo is here: http://www.studioimbrue.com

Currently, when the page loads, all the thumbnails are triggered to dim. I’m trying to make it so that each first thumb remains at full opacity (using :first of course) until another thumb is clicked. I can get it to do it for the first one, but it won’t iterate to each <ul>. I tried using the each() function, but I couldn’t get it to work. My JavaScript skills aren’t that great so if you find a solution, just post the code and then explain (if you can).

Below is the current code I’m working with:

$(document).ready(function(){
    var activeOpacity   = 1.0,
    inactiveOpacity = 0.6,
    fadeTime = 100,
    clickedClass = "selected",
    thumbs = ".thumbscontainer ul li";

    $(thumbs).fadeTo(1, inactiveOpacity);

    $(thumbs).hover(
        function(){
            $(this).fadeTo(fadeTime, activeOpacity);
        },
        function(){
            // Only fade out if the user hasn't clicked the thumb
            if(!$(this).hasClass(clickedClass)) {
                $(this).fadeTo(fadeTime, inactiveOpacity);
            }
        });
    $(thumbs).click(function() {
        // Remove selected class from any elements other than this
        var clicked, previous;
        clicked = $(this);
        if (!clicked.hasClass(clickedClass)) {
            previous = $(thumbs+'.'+clickedClass);
            previous.removeClass(clickedClass).fadeTo(fadeTime, inactiveOpacity);
            clicked.addClass(clickedClass).fadeTo(fadeTime, activeOpacity);
        }
    });
});
  • 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-13T18:54:13+00:00Added an answer on May 13, 2026 at 6:54 pm

    You need :nth-child() or :first-child:

    $(".thumbscontainer li:nth-child(1)")
    

    And actually, just change the line that reads $(thumbs).fadeTo(1, inactiveOpacity); to this instead:

    $(thumbs).not(':first-child').fadeTo(1, inactiveOpacity)
             .end().filter(':first-child').addClass(clickedClass);
    

    :first returns a single item which is index 0 in the result set. :nth-child(1) returns any item that is the first child of its parent, which is subsequently, the first li in each list.

    Important: When using :nth-child it is important to realize that the number passed to the selector is 1 based, not 0 based like most arrays or selectors. :nth-child(1) is the first child, :nth-child(2) is the second, and so forth.

    Thanks Nick!

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

Sidebar

Related Questions

I'm trying to create this effect: http://www.thecssninja.com/demo/css_tree/ the problem I'm having is that the
I downloaded the source code for an applet from here: http://www.oxygenxml.com/demo/AuthorDemoApplet/author-component-dita.html As instructed, I've
Problem description is here : http://www.spoj.pl/problems/FASHION/ Process : Took two lists as input ,
I'm trying to use jScrollPane ( http://jscrollpane.kelvinluck.com/ ) with JWPlayer 5.2 playlist ( http://www.longtailvideo.com/support/jw-player/jw-player-for-flash-v5/23/creating-a-javascript-playlist
This video explains the problem best: http://www.screencast-o-matic.com/watch/cQ1Oc9f1L Basically the directory is located here: http://www.ipalaces.org/uploaderprogress/grrrrrr.html
I'm trying to follow this tutorial: http://jqueryfordesigners.com/fixed-floating-elements/ . The problem is that whenever the
Here's a minimal batch file, demo.bat , to illustrate my problem: @ECHO off set
My Website: http://designobvio.us/portfolio/index.html Aspiring Website Layout: http://www.googlezeitgeist.com/en/top-searches/rebecca_black I've just finished my navigation bar which
Fiddle demo available here: http://jsfiddle.net/r9MCW/5/ The functionality Basically, I have a very simple table
I have this library http://www.codeproject.com/KB/cs/globalhook.aspx I've downloaded it and compiled it to DLL. At

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.