refactoring myslider.js