probably just a little problem for someone who knows what he's doing...
I'd like to create something like this: https: //marvelapp.com/404 The Gif is loaded as fullscreen background und when you push "space" you get another gif and so on. After all the gifs are seen, the loop begins again.
So I searched how to do this and I found this approach (option 3): https: //www.linkedin.com/pulse/20140702040804-99746459-change-css-background-image-with-click (also used here: How to change css background-image on click? ) There it doesn't work with space but with mouse-click what is even better.
I tried to insert a while loop to get it working with more than two pics but... it doesn't work and I don't know why
My approach: http://jsfiddle.net/h3mfk347/
function updateIndex(){
while (index < 4) {
index++;
}
} index = 0;
bodyObj.onclick = function(e){
e.currentTarget.className = className[index];
updateIndex();
}
So I guess it's more a question of the loop than of the other parts.
Thanks for any help or hint :)