Changed parseInt to parseFloat to avoid issues when there are more than five slides.