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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T00:57:02+00:00 2026-05-18T00:57:02+00:00

I am trying to implement a slideshow using jQuery I have a button called

  • 0

I am trying to implement a slideshow using jQuery
I have a button called SlideShow and clicking it would trigger the slide show.
I display a set of thumbnails:

<div class="pics">
 <img u="bob" id="pic1" src="/photos/thumbs/file1.jpg" class="apt" f="file1.jpg">
 <img u="rob" id="pic2" src="/photos/thumbs/file2.jpg" class="apt" f="file2.jpg">
 <img u="job" id="pic3" src="/photos/thumbs/file3.jpg" class="apt" f="file3.jpg">
 <img u="tom" id="pic4" src="/photos/thumbs/file4.jpg" class="apt" f="file4.jpg">
 <img u="scott" id="pic5" src="/photos/thumbs/file5.jpg" class="apt" f="file5.jpg">
</div>

You can see the thumbs has class ‘apt’ which will allow me to get the set of all thumbs.
The click event handler just need to call a function in a loop with a setInterval(f, 5000)
That way I read info of one thumb every 5 sec and load the full image from the server.

But I get undefined no matter how I do it. Here is the code:

   var idx='';
   function SlideShow() {
     idx = 1;   //global variable to track index of current thumb inside <div>
     setInterval("GetFullImage()",5000);
   }

   function GetFullImage(){
     var i = $('.apt:nth-child(' + idx + ')').attr("id"); 
     var u = $('.apt:nth-child(' + idx + ')').attr("u"); 
     var f = $('.apt:nth-child(' + idx + ')').attr("f");
     alert('i:=' + i + ' u:' + u + ' f:' + f); <-- always say i, u, f undefined after first time
     idx++;        
   }

What is wrong? I haven’t played much with setInterval() calls.

  • 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-18T00:57:02+00:00Added an answer on May 18, 2026 at 12:57 am

    You’re referencing the nth-child not the sibling. The images are all siblings of each other, not one residing in the next. I would take it up a level, then use nth-child. or just grab:

    $('.pics').children('img').length
    

    as a threshold, then use:

    $('.pics img:eq('+idx+')')
    

    This way you keep upping idx until you’ve reached the limit, then reset the counter.

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

Sidebar

Related Questions

I have been trying to implement Win32's MessageBox using GTK. The app uses SDL/OpenGL,
I've been trying to implement snook.ca's Simplest jQuery Slideshow, but when applied to child
trying to implement a dialog-box style behaviour using a separate div section with all
We are trying to implement a REST API for an application we have now.
I'm trying to implement a Lightbox -style gallery where clicking a text link launches
I am trying to implement SlideShow of google in my site www.tapasya.co.in . You
I am trying implement the Data transformation using Reflection 1 example in my code.
Trying to implement a timer for my game that I'm making. I have a
Trying to implement a simple print in SL4. I have a DataGrid that I
I trying to implement the url template tag into my project. I have a

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.