-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
image slider to about page using vanilla js.
- Loading branch information
1 parent
8de17e0
commit 3388709
Showing
7 changed files
with
62 additions
and
10 deletions.
There are no files selected for viewing
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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
var i = 0; // Start Point | ||
var images = []; // Images Array | ||
var time = 4000; // Time Between Switch | ||
|
||
// Image List | ||
images[0] = "img/image1.jpg"; | ||
images[1] = "img/image2.jpg"; | ||
images[2] = "img/image3.jpg"; | ||
images[3] = "img/image4.jpg"; | ||
|
||
// Change Image | ||
function changeImg(){ | ||
document.slide.src = images[i]; | ||
|
||
// Check If Index Is Under Max | ||
if(i < images.length - 1){ | ||
// Add 1 to Index | ||
i++; | ||
} else { | ||
// Reset Back To O | ||
i = 0; | ||
} | ||
|
||
// Run function every x seconds | ||
setTimeout("changeImg()", time); | ||
} | ||
|
||
// Run function when page loads | ||
window.onload=changeImg; |