[WIP] Using events instead of function calls

The events are triggered on the mainPage element. Whether it needs to slide
left or right (or do nothing) it's decided on the event listener.