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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T04:00:29+00:00 2026-05-29T04:00:29+00:00

I wrote a code to show images one at a time from my div.

  • 0

I wrote a code to show images one at a time from my div. My code is working, but the problem is when last image is reached, then the next image would be the first image again. In my case the slide show stops at last image. Suppose my div has four images. When I test it then one images is showing at a time, but when last images is reached then the slide show is stopped. I mean the next image is not showing. Where the first image should show as the next image.

Here I am posting my full code. Someone please have a look and tell me what is the problem in the code and, if possible, then please rectify it.

my implementation url http://jsfiddle.net/tridip/jwxzv/

 $(document).ready(function () {
    slideShow();
});

function slideShow() {
    $('#gallery img').css({ opacity: 0.0 });
    $('#gallery img:first').css({ opacity: 1.0 });
    setInterval('gallery()', 2000);
}

function gallery() {
    var current = ($('#gallery .show') ? $('#gallery .show') : $('#gallery img').first());
    var next = (current.next().length > 0 ? current.next() : $('#gallery img').first());
    next.css({ opacity: 0.0 })
    .addClass('show')
    .animate({ opacity: 1.0 }, 1000);
    current.animate({ opacity: 0.0 }, 1000).removeClass('show');
}

<style type="text/css">

.clear {
clear:both
}

#gallery {
    position:relative;
    height:360px
}
#gallery img {
    float:left;
    position:absolute;
}

#gallery img {
    border:none;
}

#gallery show {
    z-index:500
}

 </style>

<div id="gallery">
<img src="images/flowing-rock.jpg" alt="Flowing Rock" width="580" height="360" title="" alt="" class="show"  />
<img src="images/grass-blades.jpg" alt="Grass Blades" width="580" height="360" title="" alt="" />
<img src="images/ladybug.jpg" alt="Ladybug" width="580" height="360" title="" alt="" />
<img src="images/lightning.jpg" alt="Lightning" width="580" height="360" title="" alt="" />
</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-05-29T04:00:30+00:00Added an answer on May 29, 2026 at 4:00 am

    Here is corrected code http://jsfiddle.net/jwxzv/3/

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

Sidebar

Related Questions

I wrote a code to show a div element(shareform) when a link is clicked
I was wrote the following code to set the background image in one vBox.
Loading the image one time works as done in the following steps (for code
i wrote following code to create a linkbutton programmatically, but its showing like lable
I wrote some code to automatically track many objects through an 1000+ frame image
i wrote a code to zoom in, and zoom out an image using smartGWT.
Why this code show me a window without image? I try to use QByteArray
I have written my code in -(void)loadView{ } to get an image from internet
I want to show images residing inside a directory in PHP The code which
I am trying to uplaod images to folder an then trying to show them

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.