$('.search-popup').is(':visible'); if (shouldDismissSearchPopup) { onPopupClose(); } });