Currently, I am in the process of developing a website that will serve as a presentation. My plan is to create a slideshow effect using JavaScript. While I have implemented some functions, I must admit that it is not very organized at the moment. The main concept behind this project is to begin with the first slide, and upon pressing the space bar, the current slide will fade out while the next one fades in. Subsequently, pressing the space bar on the second slide should transition to the third, and so forth.
Below, you can find an example using JS BIN. However, I acknowledge that the implementation is far from ideal. Any assistance in refining and improving the functionality would be greatly appreciated. Ideally, I aim for the code to allow for easy addition of slides, but I am struggling to determine whether a for loop, switch statement, or another approach would best suit this purpose. Thank you for taking the time to read through this request.