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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T01:04:20+00:00 2026-06-09T01:04:20+00:00

I am having some really weird issues when incrementing to the next list item

  • 0

I am having some really weird issues when incrementing to the next list item to output the next href and then changing the image src with that value

It traces out and makes it to the next item then it de increments if I keep clicking the next arrow??? Below is all my code, so its nothing else that could cause the issue other then what I wrote is incorrect.

The concept is the same as a lightbox. I will also have previous arrow.

HTML:

<div role="main" id="main">
<div id="boxes">
  <ul>
         <li><a href="img/lrgimgs/1.jpg" class="lightbox"><img src="img/thumbs/1.jpg"></a></li>
         <li><a href="img/lrgimgs/2.jpg" class="lightbox"><img src="img/thumbs/2.jpg"></a></li>
         <li><a href="img/lrgimgs/3.jpg" class="lightbox"><img src="img/thumbs/3.jpg"></a></li>
         <li><a href="img/lrgimgs/4.jpg" class="lightbox"><img src="img/thumbs/4.jpg"></a></li>

   </ul>
 </div>
  <div class="nextArrow>next</div>
  <div class="previousArrow>previous</div>
</div>

JQUERY:

 var incrementVar = 0;

 $(".nextArrow").click(function() {
        incrementVar++;
        var hrefa=$('#main').find('#boxes ul li a:eq(' + incrementVar + ')').attr('href');
        $("#thumbnail").attr('src', hrefa); //I am loading the outcome of my hrefa var into another 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-09T01:04:22+00:00Added an answer on June 9, 2026 at 1:04 am

    Here’s a working fiddle: http://jsfiddle.net/Mq3wF/

    HTML:

    <div role="main" id="main">
    <div id="boxes">
      <ul>
             <li><a href="img/lrgimgs/1.jpg" class="lightbox"><img src="img/thumbs/1.jpg"></a></li>
             <li><a href="img/lrgimgs/2.jpg" class="lightbox"><img src="img/thumbs/2.jpg"></a></li>
             <li><a href="img/lrgimgs/3.jpg" class="lightbox"><img src="img/thumbs/3.jpg"></a></li>
             <li><a href="img/lrgimgs/4.jpg" class="lightbox"><img src="img/thumbs/4.jpg"></a></li>
    
       </ul>
     </div>
      <div class="nextArrow">next</div>
      <div class="previousArrow>previous</div>
    </div>​​​​​​
    

    Javascript:

    var i = 0;
    var hrefa;
    $(".nextArrow").click(function() {
         hrefa = $("li").find("a").eq(i).attr("href");
         i++;
        alert(hrefa);
     });​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Having some annoying issues with loading images into a BufferedImage (image in the example)
Having some really weird problem and as beginner with c++ I don't know why.
I am having some really weird stuff happening with my co-workers Visual Studio. We
trying to do a really basic player for testing as we're having some issues
I'm having some seriously weird issues with the Google Drive API. Bear with me
I'm having a really weird issue with some content that is being inserted with
I am having some trouble with really quite simple collision detection. Here is my
I'm really new to CodeIgniter and am having some trouble getting started. I see
Im having some problems with a simple toggle in Safari. A really annoying flickering
Probably something really simple, but I'm having some real trouble with it. I have

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.