Close javascript popup by clicking anywhere - Stack Overflow

    2024-10-19 17:37

    I am super novice and need a quick advice. I have installed a javascript based popup plugin on my wordpress site, witch opens automatically when somebody visits the site. To close the popup the user will have to click a cross X in the corner of the popup. I need to edit the plugin so that the user can click ANYWHERE, and the plugin will close.

    wordpress close popup click anywhere

    How to close a popup when clicking outside of it? - WordPress.org

    2 years, 4 months ago. Okay thanks. I have the following code now that works somewhat, but I have to click an image twice for the popup to display, but it goes away immediately: CODE. let rideImages = document.querySelectorAll(".ride-image"); let rideModals = document.querySelectorAll(".ride-description"); // Adding click event listener.

    How to close a popup when clicking outside of it? - WordPress.org

    2 years, 4 months ago. Okay thanks. I have the following code now that works somewhat, but I have to click an image twice for the popup to display, but it goes away immediately: CODE. let rideImages = document.querySelectorAll(".ride-image"); let rideModals = document.querySelectorAll(".ride-description"); // Adding click event listener.