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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T23:44:49+00:00 2026-06-06T23:44:49+00:00

This is html that looks like can anyone help me out how to add

  • 0

This is html that looks like can anyone help me out how to add the next and prev buttons to the larger image. Please help me out.

Js:

jQuery(function($) {
    $('#thumbs').delegate('img','click', function(){
        var src = this.src.replace('thumb', 'large');
        $("#largeImage").fadeOut(function() {
            this.src = src;
            $(this).fadeIn();
        });
    });
});

Html:

<div id="page">

  <div id="gallery">

    <div id="panel">
      <img id="largeImage" src="images/image_01_large.jpg" />
    </div>

    <div id="thumbs">
        <img src="images/image_01_thumb.jpg" alt="1st image description" />
        <img src="images/image_02_thumb.jpg" alt="2nd image description" />
        <img src="images/image_03_thumb.jpg" alt="3rd image description" />
        <img src="images/image_04_thumb.jpg" alt="4th image description" />
        <img src="images/image_05_thumb.jpg" alt="5th image description" />
    </div>

  </div>

  <a href="#" id="next">Next</a>
  <br />
  <a href="#" id="prev">Prev</a>

</div>
  • 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-06T23:44:50+00:00Added an answer on June 6, 2026 at 11:44 pm

    Without changing your code too much this should work. There are two things to note about how this work:

    1. The active thumbnail has a class “active”. So we can easily keep track of which larger image is currently being displayed.
    2. It relies on you keeping the id’s of the next and prev tags being named “next” and “prev”, these are used to call the corresponding jQuery functions that get the next and previous DOM elements.

          <div id="thumbs">
              <img class="active" src="images/image_01_thumb.jpg" alt="1st image description" />
              <img src="images/image_02_thumb.jpg" alt="2nd image description" />
              <img src="images/image_03_thumb.jpg" alt="3rd image description" />
              <img src="images/image_04_thumb.jpg" alt="4th image description" />
              <img src="images/image_05_thumb.jpg" alt="5th image description" />     
          </div> 
      </div> 
      <div id="gallery-nav">
          <a href="#" id="next">Next</a> <br /> <a href="#" id="prev">Prev</a>
      </div>
      

      $(function() {

        var thumbs = $('#thumbs'),
            largeImage = $('#largeImage');
      
        thumbs.delegate('img','click', function(){
            var $this = $(this).addClass('active'),
                src = $(this).attr('src').replace('thumb', 'large');
      
            thumbs.find('.active').removeClass('active');
      
            largeImage.fadeOut(function() {
                this.src = src;
                $(this).fadeIn();
            });
        });
      
        $('#gallery-nav a').click(function() {
            var type = $(this).attr('id'),
                thumbImages = thumbs.find('img'),
                next = thumbImages.filter('.active')
                        .removeClass('active')[type]();
      
              if(!next.length) {
                  next = type === 'next' ? thumbImages.filter(':first-child') : thumbs.find(':last-child');
              }
      
              var src = next.attr('src').replace('thumb', 'large');
      
            largeImage.attr('src', src);
            next.addClass('active');
        });
      

      });

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

Sidebar

Related Questions

I have html that looks like this with several items <div class=item> <p class=price>$388.00</p>
I have some HTML that looks like this: <div> <div class=value> <a href=# class=clicker>Some
I have some HTML that looks like this: <div class=product> Content In Here <div
If I have some HTML that looks like this: <div id=text> This is some
I have a composite control which emits HTML that looks like this <span id=myControl>
Absolute beginner question: I have a template file index.html that looks like this: ...
I have an html table that looks like this in a standard HTML 4.01
I'm trying to write a regular expression for html code that looks like this:
I have an HTML page that roughly looks like this: <div id=rolesRollerBody style=height: 309px;>
I have an iframe that looks like this: <iframe id=iframe2 ...> #document <html>...</html> </iframe>

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.