refactor mediascroll js