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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T03:26:33+00:00 2026-05-26T03:26:33+00:00

Here i have some code which is my slideshow and what i am wondering

  • 0

Here i have some code which is my slideshow and what i am wondering is whether you can randomize the images so it doesn’t start on the same image when you refresh the page.

Please provide me with useful info and if you wish to show me feel free.

THNAKS GUYS! 🙂

<html>
<head>
<title>JQuery Cycle Plugin Sample</title>
<link rel="stylesheet" type="text/css" media="screen" href="../screen.css" />
<script type="text/javascript" src="../js2/jquery-1.3.js"></script>
<script type="text/javascript" src="../js2/jquery.cycle.all.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        $('#myslides').cycle({
            fx: 'fade',
            speed: 2000,
            timeout: 2000
        });
    }); 
</script>
</head>
<body>
<div id="myslides"> 
    <img src="../images/capitol.jpg" />
    <img src="../images/flowers.jpg" />
    <img src="../images/countryscene.jpg" />
    <img src="../images/heartkush.jpg"/>
</div>
</body>
</html>
  • 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-26T03:26:34+00:00Added an answer on May 26, 2026 at 3:26 am

    You may want to hold image urls in a variable (or retrieve them from your div and clear the div afterwards), say

    var images = ['x.jpg', 'y.jpg', 'z.jpg'];
    

    (or even better – do some preloading). Then do a random sort

    function randomOrd(a,b)
    {
       return (Math.round(Math.random())-0.5);
    }
    images.sort(randomOrd);
    

    then dynamically add images

    for (var i in images)
    {
       $('#myslides').append('<img src="'+images[i]+'" />');
    }
    

    and then do the slideshow. The final script may look like this:

    <script>
        function randOrd(a,b)
        {
            return (Math.round(Math.random())-0.5);
        }
        $(document).ready(function(){
            var images = [];
            /* retrieve images */
            $('div#myslides img').each(function(){
                images.push($(this));
            });
            /* clear the div */
            $('div#myslides').empty();
            /* do the random sort of images */
            images.sort(randOrd);
            /* append to the div sorted images */
            for (var i in images)
            {
                $('div#myslides').append(images[i]);
            }
            /* do the slideshow */
            $('#myslides').cycle({
                fx: 'fade',
                speed: 2000,
                timeout: 2000
            });
        });
    </script>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some code here which works perfectly in firefox but not in chrome
I have some code that is using SyncEnumerator. As you can see here ,
I have some code which returns InnerXML for a XMLNode. The node can contain
I have some js code which generates an image-tag like this: main_pic_div.innerHTML =<img src='+path_big_image+?+Math.random();'
I have some code here which queries the Steam master servers to get a
I have some code here which reads from a file, and stores them in
Hi I have some code here which I dont understand public ObservableCollection<Packet> Items {
I have some code here which looks as following: if (isset($_SESSION['addToCart'])) { foreach ($_SESSION["addToCart"]
I have some code where I'm returning an array of objects. Here's a simplified
Here's my problem - I have some code like this: <mx:Canvas width=300 height=300> <mx:Button

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.