moved slide width declaration into click function