Refactor js and slider.