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

  • Home
  • SEARCH
  • 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 6626173
In Process

The Archive Base Latest Questions

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

please be easy – first post! Looking to modify the following script: http://jonraasch.com/blog/a-simple-jquery-slideshow Love

  • 0

please be easy – first post!

Looking to modify the following script:
http://jonraasch.com/blog/a-simple-jquery-slideshow

Love it’s simplicity, trying to find a way to add an advance function

Preferably on the img or div – on click or from a link.

Any suggestions?

Appreciate the help

edit, below is the script and here is a link to a working version:

link to a live testing page

script:

function slideSwitch() {
var $active = $('#slideshow IMG.active');

if ( $active.length == 0 ) $active = $('#slideshow IMG:last');

// use this to pull the images in the order they appear in the markup
var $next =  $active.next().length ? $active.next()
    : $('#slideshow IMG:first');

// uncomment the 3 lines below to pull the images in random order

// var $sibs  = $active.siblings();
// var rndNum = Math.floor(Math.random() * $sibs.length );
// var $next  = $( $sibs[ rndNum ] );


$active.addClass('last-active');

$next.css({opacity: 0.0})
    .addClass('active')
    .animate({opacity: 1.0}, 1000, function() {
        $active.removeClass('active last-active');
    });
}

$(function() {
setInterval( "slideSwitch()", 5000 );

});

style:

#slideshow {
position:relative;
height:350px;
}

#slideshow IMG {
position:absolute;
top:0;
left:0;
z-index:8;
opacity:0.0;
}

#slideshow IMG.active {
z-index:10;
opacity:1.0;
}

#slideshow IMG.last-active {
z-index:9;
}

html:

<div id="slideshow">
        <img src="image01.jpg" width="262" height="496" border="0" class="active" />
        <img src="image02.jpg" width="262" height="496" border="0" />
        </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-25T21:51:44+00:00Added an answer on May 25, 2026 at 9:51 pm

    We could do this by changing the interval to a timeout, which gives us an id which we can reset at will. Then we can use a click even to reset this interval and advance manually, which in turn will start up the interval again.

    Using the simplest example on jonraasch.com:

    window.slideInterval = null;
    
    function slideSwitch() {
        var $active = $('#slideshow IMG.active');
        var $next = $active.next();    
    
        $next.addClass('active');
    
        $active.removeClass('active');
    
        window.slideInterval = setTimeout('slideSwitch()', 5000 )
    }
    
    jQuery(function() {
        window.slideInterval = setTimeout('slideSwitch()', 5000 );
    });
    
    $(el).click(function(){
        // reset interval
        clearTimeout(window.slideInterval);
    
        // trigger next slide manually
        slideSwitch();
    });
    

    Edit

    Over the weekend I had the time to put some more attention to this, and I read up on the best practices in making a jQuery plugin. Code is slightly documented, but all in all fairly standard and not very complex, though has a fair bit of juggling with variables 🙂

    If you use anything you should use this.

    http://jsfiddle.net/sg3s/RFJMy/214/

    btw, you can just delete the prev and rand functions if you don’t want to use them, start, stop, init and transit to make the whole work.

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

Sidebar

Related Questions

My first post so please go easy on me! I know that there's no
First, I'm totally new to Obj-C please go easy on me :D I'm building
I am new to Javascript, JSON and jQuery. So please be easy on me.
Hi there , it my first time here - please go easy on me!
First time posting a question on StackOverflow, so please go easy on me :)
Im using this plugin clueTip http://plugins.learningjquery.com/cluetip/demo/ See the first example where you hover your
Please read the whole question. I'm not looking for an approach to managing multi-lingual
I'm very new to Ruby on Rails so please go easy! I've uploaded the
I'm not much into audio engineering, so please be easy on me. I'm receiving
I'm very new so just learning, so go easy please! start = int(input('How much

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.