Nicer way to update index of slides

use idx = ++idx % slides.length