Adding Right and Left Arrow Capability to Your Slideshow

Add this block of code at the top of the <script> block that appears underyour code for your images.
You do not need to copy the comments!


/* This is a bit strange looking ... but it sets the page up to "listen" 
to keydowns and to react with the function I named doSomething().
doSomething() will use the event's ( i.e. the keydown's ) keyCode.
*/


(function() {
	document.addEventListener('keydown', function(event) {doSomething(event.keyCode)})

})()



/* The doSomething() function - 
keyCode  37 is the left arrow 
keyCode 39 is the right arrow
*/



function doSomething(kCode) {
	switch (kCode) {
        case 37:  
            plusSlides(-1)
            break;
            
        case 39: 
            plusSlides(1)
            break;
    }

}