Created
July 18, 2013 22:35
-
-
Save sivagao/6033704 to your computer and use it in GitHub Desktop.
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
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> | |
<script src="jquery.backstretch.min.js"></script> | |
<script> | |
// To attach Backstrech as the body's background | |
$.backstretch("path/to/image.jpg"); | |
// You may also attach Backstretch to a block-level element | |
$(".foo").backstretch("path/to/image.jpg"); | |
// Or, to start a slideshow, just pass in an array of images | |
$(".foo").backstretch([ | |
"path/to/image.jpg", | |
"path/to/image2.jpg", | |
"path/to/image3.jpg" | |
], {duration: 4000}); | |
// Access the instance | |
var instance = $('.foo').data('backstretch'); | |
// Then, you can manipulate the images array directly | |
instance.images.push('path/to/image4.jpg') | |
// Pause the slideshow | |
$('.foo').backstretch("pause"); | |
// Advance to the next slide | |
$('.foo').backstretch("next"); | |
</script> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment