Skip to content

Instantly share code, notes, and snippets.

@srikat
Last active August 29, 2015 14:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save srikat/f7fb04ef168506f04532 to your computer and use it in GitHub Desktop.
Save srikat/f7fb04ef168506f04532 to your computer and use it in GitHub Desktop.
How to replace Home Section 1's background image with Backstretch slideshow in Parallax Pro. http://sridharkatakam.com/replace-home-section-1s-background-image-backstretch-slideshow-parallax-pro/
jQuery(document).ready(function($) {
// Create an array of images that you'd like to use
var images = [
'http://websitesetuppro.com/demos/parallax-pro-copy/wp-content/themes/parallax-pro/images/bg-1.jpg',
'http://websitesetuppro.com/demos/parallax-pro-copy/wp-content/themes/parallax-pro/images/bg-3.jpg',
'http://websitesetuppro.com/demos/parallax-pro-copy/wp-content/themes/parallax-pro/images/bg-5.jpg'
];
$('.home-section-1').backstretch(images, {
fade: 750,
duration: 4000
});
});
$images = apply_filters( 'parallax_images', array( '1', '3', '5' ) );
if ( is_active_sidebar( 'home-section-1' ) ) {
add_action( 'wp_enqueue_scripts', 'sk_enqueue_backstretch' );
function sk_enqueue_backstretch() {
wp_enqueue_script( 'backstretch', get_bloginfo( 'stylesheet_directory' ) . '/js/jquery.backstretch.min.js', array( 'jquery' ), '', true );
wp_enqueue_script( 'backstretch-init', get_stylesheet_directory_uri() . '/js/backstretch-init.js', array( 'backstretch' ), '1.0.0', true );
}
}
$images = apply_filters( 'parallax_images', array( '3', '5' ) );
$opts = apply_filters( 'parallax_images', array( '3', '5' ) );
$opts = apply_filters( 'parallax_images', array( '1', '3', '5' ) );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment