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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T21:44:28+00:00 2026-05-22T21:44:28+00:00

I have a menu on my page which changes the source of a particular

  • 0

I have a menu on my page which changes the source of a particular div(). The items are divs are located in a div called foliolist

The div where the image changes is below:

<div id="random"><img id="grouptabs" src="/u/i/1x0.jpg" /> </div>

List of items that change the div, these sit at the absolute bottom of the page

<div class="foliolist"><a href="/u/i/2.png"><img src="/v/r.gif"/></a></div>
<div class="foliolist"><a href="/u/i/4.png"><img src="/v/r.gif"/></a></div>
<div class="foliolist"><a href="/u/i/6.png"><img src="/v/r.gif"/></a></div>

Jquery code that makes it happen

$('.foliolist a').click(function(e) { 
  e.preventDefault(); 
  $('.foliolist a').css('background-color', 'transparent');  
  $(this).css('background-color', '#FFFFFF'); 
  $('#grouptabs').attr('src', $(this).attr('href')); 
});

List of items appear, first one gets selected by default with the code below

$('#bubbles > #folioholder > .foliolist > a:first').each(function(e){
  $('.foliolist').css('background-color', 'transparent'); 
  $(this).parent().css('background-color', '#FFFFFF');
  $('#grouptabs').attr('src', $(this).attr('href'));
});

I want to add new navigation bars to give the page a better usage by adding next and previous buttons images to complement the page. These will be located on the left and right side of the page.

If the left next button is clicked the progress in the grid advances, and same for the previous button but it goes backwards.

I don’t know how to approach this without looking silly so any help will be appreciated.

Thank you

  • 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-22T21:44:29+00:00Added an answer on May 22, 2026 at 9:44 pm

    Little comment : Your last snippet of code could be replaced by $('#bubbles > #folioholder > .foliolist > a:first').click();

    On the actual question :

    You’ll have to create your buttons and bind them event to retrieve the currently displayed picture to retrieve the following/previous img.

    $('#btnNext').click(function(){
        //get current picture displayed
        var currPicSrc = $('#grouptabs').attr('src');
        var foundPic = false;
        var nextPic = "";        
        $('.foliolist a img').each(function(){
            if (foundPic) {nextPic = $(this).attr('src'); return false; }
            if ($(this).attr('src') == currPicSrc) {
                foundPic = true;
            }
        });
        if (nextPic == "") {
            nextPic = $('.foliolist:first a img').attr('src');
        }
        $('#grouptabs').attr('src', nextPic);
    });
    
    $('#btnPrev').click(function(){
        //get current picture displayed
        var currPicSrc = $('#grouptabs').attr('src');
        var foundPic = false;
        var prevPic = "";        
        $('.foliolist a img').each(function(){
            if ($(this).attr('src') == currPicSrc) {
                foundPic = true;
                return false;
            }
            if (!foundPic) {prevPic = $(this).attr('src'); }
        });
        if (prevPic == "") {
            prevPic = $('.foliolist:last a img').attr('src');
        }
        $('#grouptabs').attr('src', prevPic);
    });
    

    It’s a way to do it (I’m not managing the case where you click previous on the first pic/click next on the last pic).

    Another way would be to add ids to your image and toy with them (especially easy if you’d use name like <img id="whatever1" /><img id="whatever2" /> [...] so you could get the current pic with the number in the id and then loop over that.

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

Sidebar

Related Questions

I have a menu div which changes height dynamically, depending on the content. The
I have following page in which there is a div menu. Inside menu we
I have a simple link in a menu <a id=Home href=Amico-Bio-Home-Page></a> to which i
I have a menu at the top of the page which is fixed in
I have a Menu page. If a user selects an Menu Item it opens
I have a menu within a page, I have an active class applied to
I have a menu of report links in my master page. I need to
So on my page I have a menu that is fixed to the top
In my web page, I have a menu ( HorizontalPanel ) that should be
I have a list menu in my php page. In this list menu i

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.