add enter and leave events