Below is the code I am using. Clicking outside closes the lightbox in Windows and Android, but not in iPhone and iPad.
JS:
$(document).on('click', function(event) {
if ($(event.target).has('.pop-up').length) {
$('.pop-up-overlay').hide();
}
});
HTML:
<div class="pop-up-overlay">
<div class="pop-up">
<p>Popup contents goes here.</p>
</div>
</div>