Carousel jumping on refresh

TLDR; IF statement not precise enough. Slides sliding unnecessarily.

When we're on the carousel slide and the page is saved in our CMS it triggers a refresh of the page. This causes the carousel slide to slide in from off the side of viewport. This is unacceptable to our quality assurance team. We've expanded the If statement to take into account the 3 possible situations. The slideIndex is greater than the currently displayed slide, the slideIndex is the same as the currently displayed slide and the slideIndex is less than that of the currently displayed slide.