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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:01:52+00:00 2026-05-31T17:01:52+00:00

im new at javascript and i can get this slider to work but not

  • 0

im new at javascript and i can get this slider to work but not exact to what i am after, what am i doing wrong?

Basically the slider is ment to fade in and out nicely, in mine it just shows up bluntly lol.

Here is the code

    $(function() {
    setInterval("rotateDiv()", 5000);
});

    function rotateDiv() {
    var currentDiv=$("#simlpeslider div.current");
    var nextDiv= currentDiv.next ();
    if (nextDiv.length ==0)
        nextDiv=$("#simlpeslider div:first");

    currentDiv.removeClass('current').addClass('previous');
    nextDiv.addClass('current').fadeIn('3000',function() {
        currentDiv.removeClass('previous').fadeOut('1000');});

}

The html is as follows:

<div id="simlpeslider">
                        <!-- Slide 1 -->
                        <div class="current">
                            <h6>Title 1</h6>
                            <p>Lorem ipsum dolor sit amet, consectetur elit. Maecenas non ipsum nunc, nec sagittis tellus. Lorem ipsum dolor sit amet, consectetur elit. Maecenas non ipsum nunc</p>
                        </div>
                        <!-- End Slide 1 -->
                        <!-- Slide 2 -->
                        <div>
                            <h6>iusdhfisd sdf</h6>
                            <p>Lorem ipsum dolor sit amet, consectetur elit. Maecenas non ipsum nunc, nec sagittis tellus. Lorem ipsum dolor sit amet, consectetur elit. Maecenas non ipsum nunc</p>
                        </div>
                        <!-- End Slide 2 -->
                        <!-- Slide 3 -->
                        <div>
                            <h6>eco sodalirity ltd</h6>
                            <p>Lorem ipsum dolor sit amet, consectetur elit. Maecenas non ipsum nunc, nec sagittis tellus. Lorem ipsum dolor sit amet, consectetur elit. Maecenas non ipsum nunc</p>
                        </div>
                        <!-- End Slide 3 -->
                        <!-- Slide 4 -->
                        <div>
                            <h6>asd</h6>
                            <p>Lorem ipsum dolor sit amet, consectetur elit. Maecenas non ipsum nunc, nec sagittis tellus. Lorem ipsum dolor sit amet, consectetur elit. Maecenas non ipsum nunc</p>
                        </div>
                        <!-- End Slide 4 -->
                        <!-- Slide 5 -->
                        <div>
                            <h6>ec234234234</h6>
                            <p>Lorem ipsum dolor sit amet, consectetur elit. Maecenas non ipsum nunc, nec sagittis tellus. Lorem ipsum dolor sit amet, consectetur elit. Maecenas non ipsum nunc</p>
                        </div>
                        <!-- End Slide 5 -->
                </div>

The css is:

    #simlpeslider{
    width:100%;
    float:left;
    height:150px;
    overflow:hidden;
}

#simlpeslider div {
    position:absolute;
    display:none;
    }

#simlpeslider div.previous {
    display:none;
    }
#simlpeslider div.current {
    display:block;
} 
#simlpeslider div.normal {
    display:none;
} 

Thanks

  • 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-31T17:01:53+00:00Added an answer on May 31, 2026 at 5:01 pm

    Simply, you need call fadeOut() before removing the class!

    currentDiv.removeClass('previous').fadeOut('1000');
    

    This will first remove your class “previous” from the element so that it will get back its default style inherited by the style for the id simpleslider (note your typo) which is display:none; so that fadeOut() will have no effect.

    What you want is:

    currentDiv.fadeOut('1000', function () {
       currentDiv.removeClass('previous');
    });
    

    Same goes for the fade-in. If you first add the class, which contains display:block; the element will turn visible immediately, with fadeIn having no effect.

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

Sidebar

Related Questions

I'm new to javascript and cant get this little thing to work. (all external
Sorry if this is a stupid question, but I can't get this to work.
New to javascript, but I'm sure this is easy. Unfortunately, most of the google
I'm trying to register this simple script, but i can't get this to show
I have been trying everything I can to get this script to work and
I am new to JavaScript OOP. Can you please explain the difference between the
Well, I'm completely new to JavaScript. Can you please tell me what type of
How can i concatenate var names to declare new vars in javascript?: var foo
i have a javascript method that takes a date: convert(new Date(02/20/2010); how can i
I can bind a jquery event to this element like: <script type=text/javascript> $('#new_key').ready(function() {

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.