Skip to content

Commit a0a842a

Browse files
authored
Update gprf-reload-modal-magnific.js
1 parent 970bfb9 commit a0a842a

File tree

1 file changed

+36
-23
lines changed

1 file changed

+36
-23
lines changed
Lines changed: 36 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,37 @@
1-
// Magnific Popup example using a link to trigger the modal
2-
// Replace ".open-popup" with your modal trigger
3-
// Replace "82" with the ID of your form
4-
$('.open-popup').magnificPopup({
5-
type:'inline',
6-
callbacks: {
7-
close: function() {
8-
var gwrf = window.gwrf_82;
9-
if( typeof gwrf != 'undefined' ) {
10-
gwrf.reloadForm();
11-
}
12-
}
13-
}
14-
});
1+
/**
2+
* Gravity Perks // Reload Form // Reload Form in Magnific Modal
3+
* https://gravitywiz.com/automatically-reload-gravity-form-modal-closed/
4+
*
5+
* Describe this snippet's purpose and usage. Be generous when describing both. There
6+
* is no maximum description length.
7+
*
8+
* Instructions:
9+
*
10+
* 1. Install this snippet with our free Custom JavaScript plugin.
11+
* https://gravitywiz.com/gravity-forms-custom-javascript/
12+
* 2. Two examples are included below. Remove the example that does not match your use case.
13+
*/
14+
// Example #1 – Initialize a new Magnific Popup that will automatically reload the form when the modal is closed.
15+
// Update ".open-popup" to the selector for the element that will open the modal.
16+
$( '.open-popup' ).magnificPopup( {
17+
type:'inline',
18+
callbacks: {
19+
close: function() {
20+
// Update "82" to the ID of the form within the modal.
21+
var gwrf = window.gwrf_82;
22+
if( typeof gwrf != 'undefined' ) {
23+
gwrf.reloadForm();
24+
}
25+
}
26+
}
27+
} );
1528

16-
// Example of how to bind to an already initialized Magnific Popup
17-
// Replace ".open-popup" with your modal trigger
18-
// Replace "82" with the ID of your form
19-
$('.open-popup').on('mfpClose', function() {
20-
var gwrf = window.gwrf_82;
21-
if( typeof gwrf != 'undefined' ) {
22-
gwrf.reloadForm();
23-
}
24-
});
29+
// Example #2 – Automatically reload a form when a previously configured Magnific popup is closed.
30+
// Update ".open-popup" to the selector for the element that has been previoulsy been initialized with Magnific.
31+
$( '.open-popup' ).on( 'mfpClose', function() {
32+
// Update "82" to the ID of the form within the modal.
33+
var gwrf = window.gwrf_82;
34+
if ( typeof gwrf != 'undefined' ) {
35+
gwrf.reloadForm();
36+
}
37+
} );

0 commit comments

Comments
 (0)