restructure the click event of marker