Moving length init outside of setup

Moved the length init outside of the setup() method, as it was recalculating on window resize and causing getNumSlides() to return an incorrect value