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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T12:18:34+00:00 2026-06-05T12:18:34+00:00

Here is the deal. I’m using a plugin called backstretch wich fullscreen my background

  • 0

Here is the deal. I’m using a plugin called backstretch wich fullscreen my background images and making a slideshow of it.

This is what I have for now (website of the plugin).

Now, I want the images be random each time. Say I have 3 images, it would be like:

2, 3, 1
3, 1, 2
1, 2, 3
1, 3, 2

In a line this would be: 2, 3, 1, 3, 1, 2, 1, 2, 3, 1, 3, 2

Note: images must avoid repeating themself like: 2, 3, 1, 1, 2, 3

Anyone?

  • 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-05T12:18:36+00:00Added an answer on June 5, 2026 at 12:18 pm

    Use math.Random(); to provide a random index from your array place this within a while loop and do it till you get a different number. ie.

    oldIndex = index;
    while (oldIndex == index) {
       index = Math.floor((Math.random()*images.length));
       }
    

    EDIT:
    To start with a random image use the random method before you call backstretch

    index = Math.floor((Math.random()*images.length));
    $.backstretch(images[index], {
        speed: 500
    });
    

    Your fiddle

    EDIT 2:

    After discussing with the OP requirements (in comments), they required a not entirely random slider. It was required to ensure all indexes were used before selecting any of them again then when empty then reset.

    By populating a list of indexes into a separate array we can then remove from the array as we use them until empty and then repopulate, We also mantain the previous index so that even on resetting that a image wouldn’t repeat. The final result here

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

Sidebar

Related Questions

Here's the deal. I have a big class hierarchy and I have this one
Here is the deal, in my Java project I have to make a composite
Here's the deal : I have Publication objets in my application. I also have
I have a class called Deal. Deal has vote_scores. I would like to see
Here is the deal. I have a container DIV with a width of 100%.
So here is the deal. I have a div I want to show the
So here's the deal I'm working on a project that requires me to have
So here's the deal I'm working on a project that requires me to have
Here is the deal, I have a Main class that I call from the
Here's the deal: I have a heavy layout that cannot be improved any further,

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.