Move from window click listener to jQuery's delegated event listener