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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:11:22+00:00 2026-06-11T22:11:22+00:00

with some help I have created a rotating slider using jquery and CSS3, and

  • 0

with some help I have created a rotating slider using jquery and CSS3, and it seems to be working great except for one thing… The first ‘slide’ seems to have double the delay on the first play through. Can anyone shed some light on why this might be happening? Any help would be greatly appreciated…

var i = 0;
var z = 0;
delay = 5000;

var el = $('#scroll-script');
var ql = $('#info-box');

var classesb = ['fp-info-one', 'fp-info-two', 'fp-info-three', 'fp-info-four'];    
var classes = ['fp-slide-one', 'fp-slide-two', 'fp-slide-three', 'fp-slide-four'];

var interval = setInterval(function () {

  el.removeClass().addClass(classes[i]);
  i = (i + 1) % 4;

  ql.removeClass().addClass(classesb[z]);
  z = (z + 1) % 4; 

}, delay);
  • 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-11T22:11:23+00:00Added an answer on June 11, 2026 at 10:11 pm

    Your anonymous function, the one inside the setInterval, is waiting the same amount of time (your delay) to run initially. You can either:

    1) change the anonymous function into a named function, and run that once before executing your interval

    2)Run these lines before the setInterval method. Just to emulate that the code inside the anonymous function once.

       el.addClass(classes[3]);
       ql.addClass(classesb[3]);
    

    You can look inside this fiddle, and see some solutions I have provided.

    http://jsfiddle.net/G7NdU/4/

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

Sidebar

Related Questions

I have this jQuery ajax navigation tabs plugin that I created using some help
I need some help to get this right, please. I have created an iPad
I am new to Jquery and need some help: I have a div, I
With some help from SO, I have a bit of javascript/jquery that cycles through
Need some help from javascript gurus. I have one page where http://www.google.com/finance/converter is embedded
I have created some forms using zendframework on my local machine that send the
I need some help with my problem. I have created a list of all
I have created bottom fixed tabs using jquery mobile data-role=navbar inside a JQ footer.
Sorry i am new with flex , i need some help. I have created
I need some help, I have created this function and it works fine, but

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.