-
-
Save saleiva/4335832 to your computer and use it in GitHub Desktop.
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 array = new Array(); | |
console.log("Bienvenido a tu propio proyector de diapositivas"); | |
console.log("INSTRUCCIONES DE USO"); | |
console.log("Escribe: carrusel(el número de imágenes)"); | |
console.log("Una vez introducido el número, utiliza siguiente() para avanzar"); | |
console.log("y anterior() para retroceder"); | |
console.log("¡Feliz visionado!"); | |
var posicion = 0; | |
var x; | |
var int; | |
function carrusel(_x){ | |
x = _x; | |
for (i = 0; i <= x; i++){ | |
array[i]=i; | |
console.log(i); | |
} | |
} | |
function siguiente(){ | |
if(posicion == x){ | |
console.log("Estás en la última diapositiva") | |
clearInterval(int) | |
}else{ | |
posicion = posicion +1; | |
console.log(posicion); | |
} | |
} | |
function anterior(){ | |
if(posicion == 0){ | |
console.log("Estás en la primera diapositiva") | |
}else{ | |
posicion = posicion -1; | |
console.log(posicion); | |
} | |
} | |
function play(s){ | |
int = setInterval(function(){siguiente()},s) | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment