Slider js refactor