Only add the event listener if the element is there for the navigation