add onkeydown function for sliding