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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T09:21:35+00:00 2026-06-05T09:21:35+00:00

I am trying to create a roll-in / roll-out slideshow in jQuery/JavaScript. My problem

  • 0

I am trying to create a roll-in / roll-out slideshow in jQuery/JavaScript.
My problem is, that it needs to be repeated. And right now when it’s starting over, the pictures doesnt come from the right side anymore 🙁

The reason for which I have created the slideLeft function, is that afterwards I need to create 2 functions, where the user can interrupt the slideshow manually pressing a left or right button.

This is what I’ve got:

<script class="jsbin" src="http://code.jquery.com/jquery-1.7.2.min.js"></script>

<div style='background: #c4c4c4; border: 1px solid #7b7b7b; height: 220px; overflow: hidden; padding: 5px; position: absolute; width: 590px;'>
  <div id='slider-image-1' style='left: 5px; background: red; height: 216px; padding: 2px; position: absolute; top: 5px; width: 586px;'></div>
  <div id='slider-image-2' style='left: 600px; background: yellow; height: 216px; padding: 2px; position: absolute; top: 5px; width: 586px;'></div>
  <div id='slider-image-3' style='left: 600px; background: green; height: 216px; padding: 2px; position: absolute; top: 5px; width: 586px;'></div>
  <div id='slider-image-4' style='left: 600px; background: blue; height: 216px; padding: 2px; position: absolute; top: 5px; width: 586px;'></div>
</div>

<script type='text/javascript'>
  $(document).ready(function() {
    var amount = 0;
    var nextamount = 1;
    setInterval(function() {
      amount++;
      nextamount++;
      if (nextamount === 5) nextamount = 1;
      if (amount === 5) amount = 1;
        slideLeft(amount, nextamount);
      }, 2000);
    });

  function slideLeft(i, j) {
    var $theItem = $('#slider-image-' + i);
    $theItem.animate({
      left: parseInt($theItem.css('left'), 10) == 5 ? -$theItem.outerWidth() : 5
    }, 500);

    var $theItem = $('#slider-image-' + j);
    $theItem.animate({
      left: parseInt($theItem.css('left'), 10) == 5 ? $theItem.outerWidth() + 10 : 5
    }, 500);

  };
</script>
  • 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-05T09:21:37+00:00Added an answer on June 5, 2026 at 9:21 am

    You need to prepare element, which is going to roll in, to be on the right.

    function slideLeft(i, j) {
      var $theItem = $('#slider-image-' + i);
      $theItem.animate({
        left: parseInt($theItem.css('left'), 10) == 5 ? -$theItem.outerWidth() : 5
      }, 500);
    
      var $theItem = $('#slider-image-' + j);
      $theItem.css('left', '600px'); // moves in item to the right before animation
      $theItem.animate({
        left: parseInt($theItem.css('left'), 10) == 5 ? $theItem.outerWidth() + 10 : 5
      }, 500);
    
    };
    

    I think you’ve tried it with your parseInt, but it doesn’t work, so you can get rid of it.

    function slideLeft(i, j) {
      var $outItem = $('#slider-image-' + i);
      $outItem.animate({ left: -$outItem.outerWidth() }, 500);
    
      var $inItem = $('#slider-image-' + j);
      $inItem.css('left', '600px');
      $inItem.animate({ left: 5 }, 500);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I’m trying to create a roll over affect for my ImageButton s in my
Trying to create a background-image slideshow and am getting this error... This is the
I am trying to create a link on a page that mimicks the existing
I'm trying create a box in my Django app that displays text (and possibly
I can't figure this one out. I'm trying to dynamically roll keys. I can
Im trying to create a seesaw with ball on its shape, that based on
I'm trying to create a jQuery collapsible panel and, while there are plugins around
I am trying create a WCF service that leverages the WPF MediaPlayer on the
I'm trying create a bot which automatically likes Facebook posts. Using Mechanize I can
I am trying create a delegate representation of constructor by emitting a Dynamic Method,

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.