Viewing 24 posts - 1 through 24 (of 24 total)
  • Author
    Posts
  • #1298487

    Hi in one website I have to add a popup with Magnificent popup. I tried on my local copy and it works. However on the live website I have the message

    Uncaught TypeError: jQuery(...).magnificPopup is not a function

    The page is here. As it is live, I still didn’t add the link to the popup window, as I don’t want users find a broken link. However if you check it on the console, the message is there.

    https://www.marinemammalhabitat.org/imma-eatlas/
    I just updated Enfiold to the last version, but is seems that a conflict occurs

    #1298499

    well i do not see the magnific popup script loading
    the css is loaded – but the script itself not.
    Did you mark that “Lightbox Modal Window” on theme options?

    #1298504

    Hi @Guenni007. yes the “Lightbox Modal Window” is checked. I now just uploaded the page template where I activated the html for the window I need. It’s the link you find at the right-bottom corner of teh page (Definitions-> when you click on the word a popup should come out). The style sheet is a specific one named “immas-style.css” and the function is written in the functions.php of my child theme

    function popup_inline() { ?>
    <script type="text/javascript">
    
    //.on('load') is used when jQuery migrate is disabled
    jQuery(window).on('load', function () {
        jQuery('.open-popup-link').magnificPopup({
            type:'inline',
            midClick: true,
            closeBtnInside:true
        });
    });
    
    </script>
    <?php 
    }
    add_action('wp_footer', 'popup_inline');
    #1298527

    that script is ok – and you changed it to on(‘load’ … that is totally correct here – because former load is now deprecated on jQuery 3.5.1

    the magnific popup js ( jquery.magnific-popup.min.js ) is not loaded – maybe a plugin that hampers loading it ?

    #1298530

    @Guenni007 I’m not sure. On the local version (MAMP) of the website which contains the same plugins, everything is working fine. I tried to de-activate however WP Download manager which has some popup javascript that may be in conflict, but nothing happened. The problem is still there

    #1298532

    or : do you load jQuery in the footer ?
    Try to switch that ( Enfold Options: Performance : “Load jQuery in your footer” ) and load it in the header

    Edit: no i see you load it in the header …

    hm: try to switch off
    first merging of js an css on Enfold
    second all plugins

    then turn on one after the other – and reload that page – and see what might be the reason for it.

    #1298578

    Sorry @Guenni007 but I tried: nothing worked. Any other suggestion?

    #1298596

    you are not using a child-theme – where did you place those snippets ?

    #1298601

    Yes I use a child theme (mmpatf). The magnificent popup function is called from the functions.php file. Many other snipets you may see on the page are customed: some are written on the template page and many others are called from a subfolder within the child theme that contains the whole programming code for the OpenLayers map. Everything is arranged from coding (there’s almost nothing on the enfold back-end)

    At first I thought that some javascript was conflicting with the popup, but I have an exact copy of the page on my computer an it works. The only difference is that either WP and Enfold are not updated at the last version as it is online.

    #1298613

    do you have a child-theme header.php ?

    if the still from an older Enfold, this changed header.php version must be replaced by a current one.
    For this you need to know the reason for the child-theme header.php.
    In the header.php some lightbox settings are made at the very beginning.

    #1298617

    No. Just a footer.php in the child-theme. Do you suggest to use it?

    #1298618

    no – only header.php has some entries for lightbox use.

    #1298658

    So should I use some other solution to create a popup? Maybe just a simple jquery to write directly into the template..

    • This reply was modified 3 years, 6 months ago by elenapoliti.
    #1298663

    no the point is what i said above: the magnific popup js ( jquery.magnific-popup.min.js ) is not loaded
    and there must be a reason for it. Best would be that a mod will look into your installation.

    #1298664

    Thanks for the time you spent on the issue. I hope that somebody from Kriesi may help

    #1299012

    and by the way – you load that custom ( inline popup ) script in the head section – not the footer.
    You had to be sure that jquery and magnific popup script loads before this.
    That could be one reason for “is not a function” – but the main point here is that the script itself ( magnific popup script ) isn’t loaded.

    #1299057

    Hi elenapoliti,

    Please send us a temporary WordPress admin login and login URL so that we can have a closer look. You can post the details in the Private Content section of your reply.

    Thanks @guenni007 for helping out.

    Best regards,
    Rikard

    #1299293

    Thank you very much to both @Guenni007 and @Rikard.I add in the private section the access to the admin wp. This is the page in question (https://www.marinemammalhabitat.org/imma-eatlas/) and the popup should be triggered by clicking on the link “definitions” at the right bottom of the page

    #1299330

    Please report what it actually was, because I already mentioned all the usual suspects above.

    #1299878

    Hi,

    Thank you for the update.

    This is not working correctly because as @Guenni007 pointed out, the /js/aviapopup/jquery.magnific-popup.min.js is nowhere to be found or it is not loading.

    Did you add anything in the functions.php file aside from the custom inline popup script? We tried to check the file but the Appearance > Editor panel is not accessible. Please enable the file editor so that we can check the issue properly.

    Best regards,
    Ismael

    #1299883

    Yes you are right. I just passed the while functions.php that is online. I did deregistered some scripts for that page and as a mistake (it was only on the file online) also the popup.js script!

    That was causing the problem. Sorry really for having disturbed you (and @Guenni007 too) for such a stupid mistake. That page has such complex scripts on different files that I usually use 2 different copies (one for the server and one for the local tests), and I didn’t catch the error at first.

    You can close the ticket, thank you very much

    • This reply was modified 3 years, 6 months ago by elenapoliti.
    #1299902

    well – that happens occasionally – but it must have taken a mod to make you believe it. ;)

    #1299906

    Well actually @Guenni0007 it was not that I didn’t believe you! I just didn’t realize from your advice that the problem was actually in the file functions.php. My stupidity!

    #1300077

    Hi elenapoliti,

    Great, I’m glad that Ismael could help you out, and thanks to @guenni007 for all the help as well. I’ll go ahead and close this thread for now then, please open a new thread if you should have any further questions or problems.

    Best regards,
    Rikard

Viewing 24 posts - 1 through 24 (of 24 total)
  • The topic ‘Magnificent popup is not a function’ is closed to new replies.