Last active
August 17, 2017 20:27
-
-
Save dkmy-sec/0d869fe26c638d7c455422a63006529b to your computer and use it in GitHub Desktop.
Backstretch JS Random Image Array For Backgrounds
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready(function($) { | |
// Image Array Variable | |
var images = [ | |
'/wp-content/themes/agency-pro/images/bg.jpg', | |
'/wp-content/themes/agency-pro/images/bg1.jpg', | |
'/wp-content/themes/agency-pro/images/bg2.jpg', | |
'/wp-content/themes/agency-pro/images/bg3.jpg', | |
'/wp-content/themes/agency-pro/images/bg4.jpg', | |
'/wp-content/themes/agency-pro/images/bg5.jpg', | |
'/wp-content/themes/agency-pro/images/bg6.jpg', | |
'/wp-content/themes/agency-pro/images/bg7.jpg', | |
]; | |
// Function to Shuffle through the Array Randomly | |
var slideshow = images.sort(function() { return 0.5 - Math.random() }); | |
// Displays a Random Image to begin the slideshow and randomizes the slideshow. | |
$("body").backstretch(slideshow, | |
{ | |
duration:6000, | |
fade:4000, | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment