Tagged: Lightbox
-
AuthorPosts
-
November 24, 2021 at 1:35 pm #1330292
Hi,
I would like to reload parent page after closing lightbox window.
How can I do ?
Kind regards
JorgeNovember 25, 2021 at 8:15 am #1330412Hey Jorge,
Thank you for the inquiry.
That option is not available by default but it can done using a custom script. Why do you have to reload the page?
This is an example of the script that reloads the page after clicking the lightbox close button (mfp-close).
// reload the page on lightbox close function ava_custom_script(){ ?> <script> (function($) { $(document).ready(function() { $(".avia_image").on("click", function() { setTimeout(function() { $(".mfp-wrap").on("click", function(e) { var target = e.target; if(target.classList.contains("mfp-close")) { location.reload(); } }); }, 500); }); }); })(jQuery); </script> <?php } add_action('wp_footer', 'ava_custom_script');
Best regards,
IsmaelNovember 25, 2021 at 3:00 pm #1330486Hey Ismael,
First, I would like to thank you for your response.
My purpose is to allow users to update each textbox existing on a page. User can update each textbox with a WPUF form profile displayed in a lightbox. So when a user updates a textbox, i have to refresh parent page after closing lightbox to display updated data.
Just to let you, I copy/paste your script and nothing happens. I put some ‘echo’ and no trace ;-)
Kind regards
JorgeNovember 26, 2021 at 8:08 am #1330553Hi,
Thank you for the clarification.
Where can we check the page? Please provide the URL in the private field. You may need to purge the cache and remove the browser history before checking the page. Also, please note that the script will only work when you actually click the close (x) button.
Best regards,
IsmaelNovember 26, 2021 at 4:43 pm #1330612Hi Ismael,
Please find in the private field all technical informations.
Many thanks for your help.
King regards
JorgeNovember 29, 2021 at 12:20 am #1330762Hi Ismael,
Please find in the private field all technical informations.
Many thanks for your help.
King regards
JorgeNovember 29, 2021 at 3:46 am #1330765Hi,
Thank you for the info.
Why did you add the echo function before each line? We placed a closing PHP tag after declaring the function name so that we could embed the script tag directly. Anyway, we adjusted the code in the functions.php file a bit and added a selector for the icon link (.av_font_icon a). This should work correctly now.
Please make sure to purge the cache or do a hard refresh before testing the page. The page should reload after clicking the close button.
Best regards,
IsmaelNovember 30, 2021 at 1:47 pm #1330997Hi Ismael,
I thank you for your help.
After checking my site, I notice that I’m no more able to click the close (x) button. Actually, the lightbox window is bigger that the window screen. Very weird …
Could you please check the page again ?
Kind regards
JorgeDecember 1, 2021 at 1:46 am #1331061Hi Ismael,
After checking the theme options, I notice that the Lightbox Modal Window option was disabled. Once enabled, the modal window is opening as expected. But the page do not reload after clicking the close button.
Hopefully, I founded a workaround : WPUF gives the ability to redirect to a custom URL (or page) after submitting a form.
Unfortunately, the redirection occurred into Modal Windows.
So, I have to give up the Lightbox option. Too bad !!!
I really appreciate your support and your availability :-)
Many thanks for your help.
Best regards
JorgeDecember 3, 2021 at 1:04 pm #1331445 -
AuthorPosts
- The topic ‘Lightbox’ is closed to new replies.