-
AuthorPosts
-
May 5, 2021 at 10:35 am #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 occursMay 5, 2021 at 11:25 am #1298499well 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?May 5, 2021 at 11:59 am #1298504Hi @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');
May 5, 2021 at 12:46 pm #1298527that 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 ?
May 5, 2021 at 12:53 pm #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
May 5, 2021 at 12:57 pm #1298532or : do you load jQuery in the footer ?
Try to switch that ( Enfold Options: Performance : “Load jQuery in your footer” ) and load it in the headerEdit: no i see you load it in the header …
hm: try to switch off
first merging of js an css on Enfold
second all pluginsthen turn on one after the other – and reload that page – and see what might be the reason for it.
May 5, 2021 at 2:35 pm #1298578Sorry @Guenni007 but I tried: nothing worked. Any other suggestion?
May 5, 2021 at 3:07 pm #1298596you are not using a child-theme – where did you place those snippets ?
May 5, 2021 at 3:14 pm #1298601Yes 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.
May 5, 2021 at 3:52 pm #1298613do 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.May 5, 2021 at 3:55 pm #1298617No. Just a footer.php in the child-theme. Do you suggest to use it?
May 5, 2021 at 3:56 pm #1298618no – only header.php has some entries for lightbox use.
May 5, 2021 at 5:10 pm #1298658So 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.
May 5, 2021 at 5:21 pm #1298663no 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.May 5, 2021 at 5:26 pm #1298664Thanks for the time you spent on the issue. I hope that somebody from Kriesi may help
May 7, 2021 at 6:01 pm #1299012and 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.May 8, 2021 at 6:03 am #1299057Hi 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,
RikardMay 10, 2021 at 9:09 am #1299293Thank 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
May 10, 2021 at 11:45 am #1299330Please report what it actually was, because I already mentioned all the usual suspects above.
May 12, 2021 at 11:04 am #1299878Hi,
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,
IsmaelMay 12, 2021 at 11:20 am #1299883Yes 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.
May 12, 2021 at 12:07 pm #1299902well – that happens occasionally – but it must have taken a mod to make you believe it. ;)
May 12, 2021 at 12:16 pm #1299906Well 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!
May 13, 2021 at 9:27 am #1300077Hi 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 -
AuthorPosts
- The topic ‘Magnificent popup is not a function’ is closed to new replies.