Moved slider code into js file