change the position of line according to the clicked element