Skip to content

Instantly share code, notes, and snippets.

@mralext20
Last active August 29, 2015 14:01
Show Gist options
  • Save mralext20/2cbc37b6c5704a4c5d05 to your computer and use it in GitHub Desktop.
Save mralext20/2cbc37b6c5704a4c5d05 to your computer and use it in GitHub Desktop.
<html>
<head>
<script>
var currphoto;
var play;
currphoto = '1';
function next(){
if(currphoto==33){
currphoto=1}
else{
currphoto++}
document.getElementById("gallery").innerHTML = '<img height=300px src="assets/' + currphoto + '.jpg">';
document.getElementById("num").innerHTML = 'photo number'+" " + currphoto
}
function last(){
if(currphoto==1){
currphoto=33}
else{
currphoto--}
document.getElementById("gallery").innerHTML = '<img height=300px src="assets/' + currphoto + '.jpg">'
document.getElementById("num").innerHTML = 'photo number'+" " + currphoto;
}
var timer
</script>
</head>
<body>
<div id="gallery"><img height=300px src="assets/1.jpg"></div>
<center><button onclick="next()">next</button><div id=num>photo number 1</div><button onclick="last()">last</button><button onclick="timer = setInterval(function(){next()}, 1000); ">play</button><button onclick="clearInterval(timer);">pause</button></center>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment