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

Ask A Question

Stats

  • Questions 295k
  • Answers 295k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Impose some kind of total order on instances of foo… May 13, 2026 at 6:54 pm
  • Editorial Team
    Editorial Team added an answer You could implement a java.util.Comparator (a stand-alone object that "knows"… May 13, 2026 at 6:54 pm
  • Editorial Team
    Editorial Team added an answer When in doubt, check the documentation: http://www.telerik.com/help/aspnet-ajax/grid-command-reference.html May 13, 2026 at 6:54 pm

Related Questions

I've just bought a Rainbowduino to control a load of individual LEDs (NOT an
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 building a mobile web application that may or may not rely on ajax,
This is probably a Wordpress issue more than a Friendfeed issue but could be
I have a page with a 100% width/height flash movie that is overlayed with

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.