add events on show and on hide