add loopImages() function to buttons