menu builder class, js scroll direction detection