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 8388379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:27:42+00:00 2026-06-09T18:27:42+00:00

I am working on a simple image gallery with a larger picture displayed above

  • 0

I am working on a simple image gallery with a larger picture displayed above a line of thumbnails below. I have set the initial opacity of each thumbnail to 0.3 by using a css rule targeting the li. Using javascript I want to change the opacity of the thumbnail that is currently selected to 1, but keep the rest set at 0.3.

I have managed to change the current thumbnail’s opacity from 0.3 to 1 but what I cannot figure out how to do is change the previous (or next) thumbnails opacity back to 0.3.

For example, if thumbnail #3 is currently selected I want all the remaining 5 thumbnails to revert back to their orignal opacity setting of 0.3

I have put some of my code into the below link so you can get an idea of what I going on about.

div class=”thumbnails”>

<ul>
    <li><a href='#' class='thumb' id="thumb_1"></a></li>
    <!-- MORE FOLLOW -->
</ul>

$("#nextBtn").click(function() {
    currentPic++;
    $(".thumbnails ul li:nth-child(" + currentPic + ")").animate({
        "opacity": "1"
    });
});

Full code sample: http://jsfiddle.net/nqKJw/

  • 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-06-09T18:27:43+00:00Added an answer on June 9, 2026 at 6:27 pm

    In the function where you are setting the opacity of the desired thumbnail to 1, first set all thumbnails to an opacity of .3:

    $("#nextBtn").click(function() {
        $(".thumbnails ul li").animate({
            "opacity": "0.3"
        });
        currentPic++;
        $(".thumbnails ul li:nth-child(" + currentPic + ")").animate({
            "opacity": "1"
        });
    });
    

    Try it: http://jsfiddle.net/nqKJw/1/

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

Sidebar

Related Questions

I created a simple image gallery where I have a large picture in the
I have a simple image gallery that I've paginated, and I want to to
I have written a simple image gallery scrip witch checks a folder and displays
Good Day, I have a simple working routine in Perl that swaps two words:
I am looking for a simple picture gallery for iPhone (photo viewer). I was
I have a user avatar on my website. Simple image tag: <img src=foo.jpg class=userphoto
I'm trying to make simple image gallery with html/css and a bit of javascript.It's
Here is a simple image gallery script for fading in and out divs with
I am using LightBox2 for a simple image gallery. I managed to make it
I'm working on a site for car classifieds. I searched for an image gallery

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.