 
	
		
		
		
		
			
- 
		AuthorPosts
- 
		
			
				
September 29, 2018 at 6:00 pm #1016107Hi, I tried many alternatives to issue an alert when a POPUP is closed, BUT none resulted. 
 Follow the code:<script type="text/javascript"> jQuery(window).load(function(){ jQuery('.open-popup-link').magnificPopup({ type:'inline', callbacks: { close: function() { alert("Popup was closed"); }, }, midClick: true }); }); </script>I followed the documentation of the magnific popup; http://dimsemenov.com/plugins/magnific-popup/documentation.html Any suggestion? Thanks September 29, 2018 at 7:28 pm #1016146Hey CloudChoice, 
 The close event occurs before the alert prompt can be created, but you can simulate the event with this:(function($){ $(document).ready(function(){ $("#test-popup").click( function () { ShowAlert(); }); }); })(jQuery); function ShowAlert() { alert("Alert Message Closed"); }notice it targets the ID for the popup box, my popup was like this: <div id="test-popup" class="white-popup mfp-hide"> this is the content of the popup box </div>Best regards, 
 MikeSeptember 29, 2018 at 9:05 pm #1016169Ho Mike, The problem is that this form triggers the alert just in case you use a (X) button to close the popup. If you press ESC or click on the overlay it will not fire. Best regards, - 
		This reply was modified 7 years, 1 month ago by CloudChoice. 
 September 29, 2018 at 10:08 pm #1016177Hi, 
 I see, you almost had it the first time, this one works with click & escjQuery(window).load(function(){ jQuery('.open-popup-link').magnificPopup({ type:'inline', midClick: true, callbacks: { beforeClose: function() { ShowAlert(); }, }, }); }); function ShowAlert() { alert("Alert Message Closed"); }Best regards, 
 MikeOctober 1, 2018 at 7:04 pm #1016721Hi Mike, The problem was 100% resolved. Thanks 
- 
		This reply was modified 7 years, 1 month ago by 
- 
		AuthorPosts
- The topic ‘Alert when popup is closed’ is closed to new replies.
