-
AuthorPosts
-
February 15, 2021 at 4:45 pm #1280580
Dear support,
i open my contact forms in popupwindow with this code.
It doesn’t work anymore without the old jQuery-Version, which i installed with the jQuery-helper-plugin.
The errrormessage is: Content Security Policy: Ignorieren von “‘unsafe-inline'” innerhalb script-src: ‘strict-dynamic’ angegeben
You know how to change the code to make it compatible with the newest wp-version?
Best regards//open form in lightbox function popup_inline() { ?> <script type="text/javascript"> jQuery(window).load(function(){ jQuery('.open-popup-link').magnificPopup({ type:'inline', midClick: true // Allow opening popup on middle mouse click. Always set it to true if you don't provide alternative source in href. }); }); </script> <?php } add_action('wp_head', 'popup_inline');
February 15, 2021 at 5:14 pm #1280589See here:
https://kriesi.at/support/topic/magnific-popup-doesnt-work-anymore/#post-1277163
if you got other scripts with load or click event – replace them all by .on(‘load’,… and .on(‘click’, …
PS: it is not neccessary to load this script in the header area – so wp_footer is good too.February 15, 2021 at 5:35 pm #1280597Thanks Guenni007,
so i change my javascript in the functions.php to this and the popup would work again with the newer jquery-Version?function add_custom_script(){ ?> <script type=”text/javascript”> jQuery(window).on('load', function () { jQuery(‘.open-popup-link’).magnificPopup({ type:’inline’, midClick: true }); }); </script> <?php } add_action(‘wp_footer’, ‘add_custom_script’);
And the button to open the popup is still this?
<a class="open-popup-link" href="#anmelde-popup">Infos anfordern</a>
February 15, 2021 at 5:50 pm #1280601Everything stayes the same but you have instead of:
jQuery(window).load(function(){
that:
jQuery(window).on('load', function () {
do not forget to clear all browser cache and to refresh (if used) the merged files in enfold (see performance tab in enfold options)
See here in the first yellow frame: https://api.jquery.com/load-event/
February 15, 2021 at 8:22 pm #1280632Thank you so much :-)
February 16, 2021 at 1:33 am #1280674Hi,
Did you need additional help with this topic or shall we close?
Best regards,
Jordan Shannon -
AuthorPosts
- You must be logged in to reply to this topic.