Title: Randomised images
Last modified: August 30, 2016

---

# Randomised images

 *  [nameloc082](https://wordpress.org/support/users/nameloc082/)
 * (@nameloc082)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/randomised-images/)
 * This plugin is great! But, is there a way to make the images in the backstretch
   media library randomised?
 * [https://wordpress.org/plugins/easy-backstretch/](https://wordpress.org/plugins/easy-backstretch/)

Viewing 1 replies (of 1 total)

 *  [carefulmistake](https://wordpress.org/support/users/carefulmistake/)
 * (@carefulmistake)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/randomised-images/#post-6640925)
 * You can do this by simply adding a randomization to the JS before output. This
   is what I changed at the bottom of the plugin’s easy-backstretch.php.
 *  <script type=”text/javascript”>
    jQuery(document).ready(function($) { ** function
   shuffle(a) { var j, x, i; for (i = a.length; i; i -= 1) { j = Math.floor(Math.
   random() \* i); x = a[i – 1]; a[i – 1] = a[j]; a[j] = x; } return a; } var images
   = []; <?php foreach($easy_backstretch_images as $image => $data): ?> images.push(‘
   <?php echo $data[‘file_url’]; ?>’); <?php endforeach; ?> var index = 0; var backstretchSettings
   = { fade: <?php echo $easy_backstretch_settings[‘fade’]; ?>, duration:<?php echo
   $easy_backstretch_settings[‘duration’];?>}; var len = images.length; var totalDuration
   = (backstretchSettings.fade + backstretchSettings.duration); var timer = null;//
   Randomizer order before display shuffle(images); var rotate = function() { $(‘
   <?php echo $easy_backstretch_settings[“div”]; ?>’).backstretch(images[0], backstretchSettings);
   timer = setInterval(function() { index++; if(index == len) { index = 0; } $(‘
   <?php echo $easy_backstretch_settings[“div”]; ?>’).backstretch(images[index],
   backstretchSettings); }, totalDuration); }; rotate(); }); </script>

Viewing 1 replies (of 1 total)

The topic ‘Randomised images’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/easy-backstretch.svg)
 * [Easy Backstretch](https://wordpress.org/plugins/easy-backstretch/)
 * [Support Threads](https://wordpress.org/support/plugin/easy-backstretch/)
 * [Active Topics](https://wordpress.org/support/plugin/easy-backstretch/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/easy-backstretch/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/easy-backstretch/reviews/)

## Tags

 * [backstretch](https://wordpress.org/support/topic-tag/backstretch/)

 * 1 reply
 * 2 participants
 * Last reply from: [carefulmistake](https://wordpress.org/support/users/carefulmistake/)
 * Last activity: [10 years, 3 months ago](https://wordpress.org/support/topic/randomised-images/#post-6640925)
 * Status: not resolved