• Resolved Anthyx

    (@anthyx)


    Hello RavanH,

    a couple of years ago I needed Easy Fancybox NOT to open the images from wikipedia commons but, instead, to open the link to the corresponding page.

    My website is https://www.webfoodculture.com

    You suggested me to include this string in the footer.php

    jQuery(document).ready(
    function(){ jQuery(‘a[href*=”commons.wikimedia.org”]’).addClass(‘nolightbox’); }
    );

    Sadly, this seems not work anymore. Could you help me please?
    Could it be an idea for a feature to be included in a future version of the plugin?

    Many many thanks in advance Rav!

    Ciao

    A.

    • This topic was modified 5 years, 12 months ago by Anthyx.

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

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi @anthyx this is happening because the script snippet runs before the needed jQuery librairy is loaded. The main jQuery appears to load at wp_footer() which normally runs in the footer.php file. The FancyBox scripts are loaded just after that. This does not leave any room for our little script snippet which needs to run before the fancybox scripts…

    Is there a plugin that moves javascript to the footer? Any way to exclude jQuery?

    Thread Starter Anthyx

    (@anthyx)

    Hi Rav, as always, thanks a lot for your help.

    You’re right, I have recently installed the ‘sped Booster’ Plugin. This has many options, among them, this one:

    Move scripts to footer

    I have tried to enable and disable all the others and the problem is this one.

    In the ‘advanced options’, the plugin allows to exclude scripts from being moved to the footer. I have chosen to exclude these:

    jquery-fancybox
    jquery-easing

    Well, your js now works fine and I keep my page optimization.

    Hope this will be useful to people using your plugin and Speed Booster.

    Many thanls again Rav!

    Ciao!

    Good to hear you were able to fix the conflict ??

    Two notes: (1) the jquery-fancybox and jquery-easing scripts are already being loaded in the footer by Easy FancyBox so there is nothing lost there ?? and (2) looking at your page source code, I see the jQuery library is requested twice in the header now. First just before the addtoany script (which seems logical) and then a second time just before the Google Tag Manager snippet. Not sure why…

    Thread Starter Anthyx

    (@anthyx)

    I see, should I try to delete the second one (keeping a backup of the original code in any case) ?

    Tnx Rav!

    If you know where that second one I coming from then yes you could remove it. Keep a copy of the original code is always a good idea and of course test your site to see if nothing broke after the modification ??

    Thread Starter Anthyx

    (@anthyx)

    … and again, thanks for your help Rav!

    Ciao!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Stop Easy FancyBox from opening images.’ is closed to new replies.