adding recent practice for building a slider in jQuery + the refactored version to streamline the code