Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #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');
    #1280589

    See 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.

    #1280597

    Thanks 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>

    #1280601

    Everything 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/

    #1280632

    Thank you so much :-)

    #1280674

    Hi,

    Did you need additional help with this topic or shall we close?

    Best regards,
    Jordan Shannon

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.