• Resolved sitenex

    (@sitenex)


    Hey there,

    Recently FancyBox has stopped working for. On my site, in the header there is an envelope icon that when I use to press it would pop up inline content. Now, it is no longer working and in Google’s Console it is showing this error:

    Uncaught ReferenceError: jQuery is not defined
    at (index):1167:1

    The plugin is updated and I have inline content enabled. For choose your lightbox I have “FancyBox Classic Reloaded” selected. I tried the other options too, but the issue remains.

    Would you be opposed to helping me fix this?

    Thanks,

    Anthony

    The page I need help with: [log in to see the link]

Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Author FirelightWP

    (@firelightwp)

    Hi,

    Yes, the lightbox requires jquery to work. There appear to be two issues:

    1. First your site is not loading jquery. It should load by default on most WordPress sites. We / you need to figure out why it is not loading on yours.

    The only way to produce that using our plugin is to toggle the option to not use jquery. Can you please be sure that this option is not checked? https://d.pr/i/UKfbfA

    Otherwise, please check if you have any other plugins or code that would be preventing jquery from loading.

    2. Second, and a bit more confusing… Normally, if jquery is not there, we simply will not load the fancybox scripts. So if everything is working as expected, and jquery is not there, you shouldn’t get the console error. What should be happening is… just nothing. The link simply won’t work because we detect jquery is not there as a dependency and do not load our scripts.

    The only way to load our scripts without jquery is to toggle the option I mentioned above. So I’m hoping that’s what you’ve done somehow. Otherwise, I probably need to figure how you are getting the lightbox to load without jquery.

    Thread Starter sitenex

    (@sitenex)

    Thanks, I appreciate your help.

    1 – For:

    Do not include standard WordPress jQuery library (do this only if you are sure jQuery is included from another source!)

    This is Not Checked.

    2 – Another interesting thing is that the lightbox will work if I’m logged into the WordPress Admin, but not if I’m logged out.

    Cheers,
    Anthony

    Thread Starter sitenex

    (@sitenex)

    Hey there,

    I hope you are well!

    Would you’d be against letting me know if you have any idea of why this is happening?

    Thanks,
    Anthony

    Plugin Author FirelightWP

    (@firelightwp)

    Hi @sitenex

    Sorry for the delay. Ok, so we just need to figure why jquery is not loading (or if it is, why our lightbox is not seeing it. I just checked your home page based on your link above, and I *do* see jquery on the page. I don’t see any galleries on that page. Could you provide a link to a page with a gallery? I’d like to see the console error and double check if jquery is loading or not.

    Thread Starter sitenex

    (@sitenex)

    Thanks for getting back to me.

    If you go to https://frederictonphysiotherapy.com/ and in the top right of the header click on the envelope with a letter icon. This is suppose to open inline content so people can fill out a contact form.

    As mentioned, this works when I’m logged into WordPress, but not when I’m logged out.

    Thanks,
    Anthony

    Plugin Author FirelightWP

    (@firelightwp)

    Hey – This not something I can duplicate, and I also can’t understand or think of a reason it would be happening. I’m wondering if you’d be willing to reach out to me at firelightwp.com/contact to coordinate on some more in-depth troubleshooting? Please just reference this thread if so.

    Otherwise, I may need to suggest some code edits/changes (if you know a bit of PHP) so we can try to eliminate some possible causes.

    Plugin Author FirelightWP

    (@firelightwp)

    One small finding that’s really confusing me is that jquery IS loaded on your page. So jQuery is there is there, but you are still somehow getting a ‘jQuery is not defined’ error.

    Plugin Author FirelightWP

    (@firelightwp)

    Actually, I think I know what is going on. I think you are using a plugin that is minifying and concatenating javascript files, and thus changing how they are loading. It is taking our javascript, which should be loaded after jquery, and it is combining it with other JS and loading it before jquery.

    Looking at your site and what’s loaded, I suspect it may be the site ground optimizer. Can you confirm if you’re using that plugin?

    If so, please try excluding our javascript.

    I think you could do it like this:

    1. From dashboard, go to SG Optimizer Settings
    2. Go to Frontend tab
    3. Scroll down to the ‘Minify JavaScript Files’ section, and in the ‘Exclude from Minification’ and ‘Exclud from Combine JS’ sections, you can add a file or ‘handle’. The handle for our file is ‘jquery-fancybox’ so add that in both fields. You can also try the file path, which should be ‘/wp-content/plugins/easy-fancybox/fancybox/1.5.4/jquery.fancybox.min.js’
    4. Save

    There are also some code base ways to do this outlined here:
    https://www.siteground.com/tutorials/wordpress/speed-optimizer/custom-filters/



    Thread Starter sitenex

    (@sitenex)

    Thanks, I really appreciate your help.

    I tried this on https://frederictonphysiotherapy.com/ but it is still not working. And there is still an error in the Google Console.

    Thanks,

    Anthony

    Plugin Author FirelightWP

    (@firelightwp)

    Hi there – We have progress because the JS for our plugin is actually loaded on your page independently now rather than being bundled with something else from Siteground Opimizer.

    I can still see the error on your page, and it is still going to be a conflict with siteground optimizer.

    The next thing to try is please exclude jquery in the section about excluding files from defer / render blocking javascript.

    You will need to exclude:
    /wp-includes/js/jquery/jquery.min.js
    /wp-includes/js/jquery/jquery-migrate.min.js

    It will look like this when done (arrows show what to click on).
    https://d.pr/i/WUmI1l

    Thread Starter sitenex

    (@sitenex)

    Thanks for the help and screenshots. I really appreciate it.

    This fixed my issue. Thanks again for all of your help. I appreciate you taking so good care of me. ??

    Cheers,
    Anthony

    Plugin Author FirelightWP

    (@firelightwp)

    Great! Very glad we managed to get this resolved.

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