Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var id = ["id1","id2","id3"]; //Array with the id's in the document you want to shuffle through
- function resetValue() {
- var i = 0;
- initiateTimer();
- }
- fuction initiateTimer() {
- if(i > 3) {
- resetValue();
- }
- var t = setTimeout(changeElement();, 5000)); //5000 = 5 seconds
- }
- function changeElement() {
- document.getElementById(id[i-1]).style.display = 'none';
- document.getElementById(id[i]).style.display = 'block';
- i += 1;
- initiateTimer();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement