In-class assignment sliding javascript