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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T16:30:58+00:00 2026-06-10T16:30:58+00:00

I made a vertical jQuery slideshow to where if you click 3 different images

  • 0

I made a vertical jQuery slideshow to where if you click 3 different images the table slides. This works perfect, but I also need it to slide on a timed function. I have tried doing loops with timeout functions but then my code for the click doesn’t work and the timing feature doesn’t even work. The attempt at a timing is at the bottom if it could just have a small mistake or something.

Original click function (works)

$(document).ready(function() {


    $("#slide1-1").click(function() {
        $("#slide1_images").css("top","0");
        $(".imagetab").css("opacity","1.0");
        $(".imagetab").css("filter",'alpha(opacity="100")');
        $(".imagetab2").css("opacity",".4");
        $(".imagetab2").css("filter",'alpha(opacity="40")');
        $(".imagetab3").css("opacity",".4");
        $(".imagetab3").css("filter",'alpha(opacity="40")');

    });
    $("#slide1-2").click(function() {
        $("#slide1_images").css("top","-430px");
        $(".imagetab2").css("opacity","1.0");
        $(".imagetab2").css("filter",'alpha(opacity="100")');
        $(".imagetab").css("opacity",".4");
        $(".imagetab").css("filter",'alpha(opacity="40")');
        $(".imagetab3").css("opacity",".4");
        $(".imagetab3").css("filter",'alpha(opacity="40")');

    });
    $("#slide1-3").click(function() {
        $("#slide1_images").css("top","-860px");
        $(".imagetab3").css("opacity","1.0");
        $(".imagetab3").css("filter",'alpha(opacity="100")');
        $(".imagetab2").css("opacity",".4");
        $(".imagetab2").css("filter",'alpha(opacity="40")');
        $(".imagetab").css("opacity",".4");
        $(".imagetab").css("filter",'alpha(opacity="40")');

    });

});

Timing attempt (doesn’t work)

        $(document).ready(function() {

    var slide = function() {
    $("#slide1_images").css("top","0");
    }

    var slide2 = function() {
    $("#slide1_images").css("top","-430px");
    }

    var slide3 = function() {
    $("#slide1_images").css("top","-860px");
    }

    var i;

    for(i = 0; i < element.length; ++i) {
    if (i=="1")
     {
      setTimeout(slide, 2000);
     }
    if (i=="2")
     {
      setTimeout(slide2, 2000);
     }
    if (i=="3")
     {
      setTimeout(slide3, 2000);
     }
    if (i=="4")
     {
      var i = "0";
     }

    }

 *INSERT CODE FROM ABOVE HERE.*

        });
  • 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-10T16:31:00+00:00Added an answer on June 10, 2026 at 4:31 pm

    You should be able to generalize your solution instead of duplicating so much of the code, since you do more or less the same thing for each tab. This solution reduces a lot of the redundancy:

    function slide() {
        $("#slide1_images").css("top", "0");
    }
    
    function slide2() {
        $("#slide1_images").css("top", "-430px");
    }
    
    function slide3() {
        $("#slide1_images").css("top", "-860px");
    }
    
    $(document).ready(function() {
        setTimeout(slide, 2000);
        setTimeout(slide2, 4000);
        setTimeout(slide3, 6000);
        $("#slide1-1, #slide1-2, #slide1-3").click(function() {
            var index = $(this).index("#slide1-1, #slide1-2, #slide1-3");
            var tab = ['.imagetab', '.imagetab2', '.imagetab3'];
    
            $( tab[index] ).css("opacity", "1.0");
            $( tab[index] ).css("filter", 'alpha(opacity="100")');
            $( tab[(index+1) % 3] ).css("opacity", ".4");
            $( tab[(index+1) % 3] ).css("filter", 'alpha(opacity="40")');
            $( tab[(index+2) % 3] ).css("opacity", ".4");
            $( tab[(index+2) % 3] ).css("filter", 'alpha(opacity="40")');
        });
        $("#slide1-1").click(slide);
        $("#slide1-2").click(slide2);
        $("#slide1-3").click(slide3);
    });​
    

    Also, it should be noted that you don’t even need setTimeout for these animations; jQuery has a built in .animate() function for modifying css properties with a smoother transition:

    $("#slide1_images").animate({ top: "-860px" }, 2000 );​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've made gradient images using PHP GD horizontal and vertical but how can you
Made this nice little loop for hiding and showing div's, works as a charm
I made a dll in c# but i need to export the functions. Is
I'm using the scrollTo plugin for jQuery on a website. I made a vertical
I have recently made a horizontal and vertical scrolling site using jquery.scrollTo On the
I have made a jQuery plugin that works fine when applied to a single
i made a vertical menu. I want that the first tab has a different
I made a UITableViewCell and I have 20 rows in that table in which
I have a 'toolbar' div that I made resizable via jQuery UI. The weird
I tried to change the width of seekbar and made it thin. But my

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.