Wrote even handler function for swithing slide