addEvent(carousel, 'click', function(e) {
var target = e.target;
if (target.tagName == 'BUTTON' && target.className.indexOf('control') !== -1) {
direction = (target.className.indexOf('next') !== -1) ? 'next' : 'prev';
moveSlides(direction);
}
if (target.tagName == 'IMG') {
direction = (target.src.includes('image')) ? 'prev' : 'next';
moveSlides(direction);
}
});