-
-
Save eksana/f3f60d599072f1d58b4b9b58b9c7cfc5 to your computer and use it in GitHub Desktop.
galleryJS
This file contains 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
var Gallery = new Object(); | |
window.onload= function() | |
{ | |
Gallery.Images = ['istockphoto_14149033.jpg', 'istockphoto_14232771.jpg', 'istockphoto_14667148.jpg']; | |
Gallery.CurrentIndex = 0; | |
Gallery._loopInterval = setInterval(Gallery.Next, 2500); | |
}; | |
Gallery.Next = function() | |
{ | |
if(Gallery.CurrentIndex < (Gallery.Images.length-1)) | |
{ | |
Gallery.CurrentIndex++; | |
} | |
else | |
{ | |
Gallery.CurrentIndex = 0; | |
} | |
Gallery.Display(); | |
}; | |
Gallery.Prev = function() | |
{ | |
if(Gallery.CurrentIndex > 0) | |
{ | |
Gallery.CurrentIndex--; | |
} | |
else | |
{ | |
Gallery.CurrentIndex = (Gallery.Images.length-1); | |
} | |
Gallery.Display(); | |
}; | |
Gallery.Display = function() | |
{ | |
var photoGallery = document.getElementById('photo-gallery'); | |
var currentImage = Gallery.Images[Gallery.CurrentIndex]; | |
photoGallery.src = "../assets/img/"+currentImage; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment