Register the events on the links instead of delegated to the document.