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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T08:08:17+00:00 2026-06-14T08:08:17+00:00

I am having a bit of a problem trying to get this code to

  • 0

I am having a bit of a problem trying to get this code to work, for some reason I just can’t seem to find what is wrong. If anybody knows what I can do to make it show a slide for about 3 sec then fade out and show a new one and at the end go back to the first and loop that would be great! Below I have posted the code I have right now. I really need some help as this project is due in 2 weeks and I have a lot more work to do, thanks!

    <section class="clearfix">
    <div id="snapshots">
        <article>
            <img src="http://static.tumblr.com/dbek3sy/4mem1qr1m/themes_image.png">
        </article>
        <article>
            <img src="http://static.tumblr.com/dbek3sy/q8Em247a0/slidehome_4.png">
        </article>
        <article>
            <img src="http://static.tumblr.com/dbek3sy/dsLm2trr5/slidehome_5.png">
        </article>
    </div>
    </section>​


    /* joey content slider function */
    window.onload = function() { 

    var time = 1500;
    var content = $('#snapshots');
    var cont = 1;


    // MARK THE ARTICLES AND CONTENT
    $(function article(){

    // how many slides 
    // an = article number
    var an = content.find("article").length;

    // define the amount of slides in a class name 
    // example: <div class="slides_6">
    content.addClass("slides_"+an);

    // slide switcher 
    content.append('<div id="switch"></div>');

    };




// FIND AND MARK SLIDES
$(function slides() {
    numb = 1;
    content.find("article").each(function(){
        $(this).addClass("slide_"+numb);
        numb++;
        $(this).hide();
    });

    //setTimeout("", 4000);
}


function slider(content, time){
    content.fadeOut(time, function() {

    // plus 1 slide 
    var conta = cont+1;

    $("article.slide_"+conta).animate({
        "display": "block"
    },1500);

    $("article.slide_"+cont).animate({
        "display": "none"
    },1500);

    setTimeout("doitdude()", 4000);

    });

}


// RESET SLIDE
function reset(content, time) {

    // fade out content 
    content.fadeOut(time, function(){

    // while fading out 

    // show first slide 
    $("article.slide_1").animate({
        "display": "block"
    },1500);
     // hide the last one 
    $("article.slide_"+conta).animate({
        "display": "none"
    },1500);

    // end transition
    });


    setTimeout("doitdude()", 4000);
}


function doitdude() {
    if(cont < an) {
        slider(content, 1000);
        cont++;
    }
    else{
        var conta = cont;
        var cont = 1;
        // reset code here:
        reset()
    }


};​


    #snapshots { overflow: hidden; height: 410px; width: auto; }
    #snapshots img { }​

Note: I can’t use a plugin because I am trying to make my own. Thanks!

Also a JsFiddle here:

http://jsfiddle.net/UYE4E/

  • 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-14T08:08:18+00:00Added an answer on June 14, 2026 at 8:08 am

    Your function declaration is incorrect. Probably you are trying to do following:

    (function($) {
        function foo(){
            //foo body
        };
    }(jQuery) );
    

    Anyway, read about JS scopes and closures.

    Article 1 Article 2

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

Sidebar

Related Questions

I'm having a bit of an odd problem while trying to compile some code
I'm having a bit of an issue trying to get some PHP code to
EDIT: Having gotten this to work under 32-bit, I'm now trying to get it
I am having a bit of a problem, I am trying to get a
I'm trying to make a piece of dojo Code work and having a bit
I'm having a bit of a problem using FieldOffset correctly with arrays. The code
I'm having a bit of a problem figuring out how to get the X/Y
I'm having an annoying problem trying to get an html page with a google
I am having a problem trying to deserialise this XML: <?xml version=1.0 encoding=UTF-8?> <links>
I'm having a bit of a weird problem. I'm trying to write an interface

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.