Support » Plugin: Easy FancyBox » About that AJAX issue…

  • Resolved jmartin01


    Hi Ravan –

    I found this comment you posted on another question, and I think this is the key to my problem – though I couldn’t seem to find the actual work-around anywhere for actually dealing with it. Do you think you could clue me in on the ‘rescan document for media links’ part? I do have an event triggered after…(if I’m wrong, I’ll just find a way to add one):

    “Hi, if your theme is loading content (media links) through AJAX, you’ll have a problem. FancyBox searches for media and binds itself to the links upon ‘document ready’ and all content loaded after that event will not be treated.

    Do you know it your theme triggers an event after each new content has loaded? If there is an event triggered, then it could be used to fire a rescan of the document for media links…”

    Here’s a link to where fancybox should work on pictures:

    ALSO – fancybox is employed for iframe/pdf/google-viewer links on this page: Should work for the “read more” links after the excerpts.

    Thank you!!

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author RavanH


    Hi Jena, yes, it looks like you’re facing the ajax issue. Can the theme developer tell you if there is a javascript event triggered after new content has been loaded? If so, that could be used to fire fancybox (again) but if not, there is no way to get it working at this point I’m afraid…

    Yes, there is an event triggered after the new content is loaded (I’m the theme developer along with my buddy here who did the javascript).

    Is there just a snippet we can run in our last event to fire fancybox again?

    Thanks for your response!

    Plugin Author RavanH


    There are two ways, both need the development version of Easy FancyBox:

    That version has a function handle called easy_fancybox_handler that is used in

    <script type="text/javascript">
    jQuery(document).on('ready gform_post_render', easy_fancybox_handler );

    One method could be to add the event name that is triggered after new content has loaded to the list 'ready gform_post_render' (gform_post_render is an event by gforms) by modifying the easy-fancybox-class.php file on line 497.

    Another method could be modifying the theme and you seem to be just the person to do that 😉 You can use the handle easy_fancybox_handler to launch the complete script again whenever you need to 🙂

    Plugin Author RavanH


    Note: be aware that if you try to call easy_fancybox_handler when the Easy FancyBox plugin is not installed or deactivated, an Undefined variable exception error will be thrown so you need to do a if(typeof easy_fancybox_handler == 'function') check before calling it.

    Alternatively, you could trigger an event called gform_post_render upon each new content. Maybe that’s the easiest 🙂


    Thank you thank you thank you.

    We tried your last method (triggering the event gform_post_render upon new content loading in the theme’s script) – and it didn’t work at first – we realized there was an error in the console saying that ‘Object#<Object> has no method on’ and it was referring to the very line in the fancybox plugin that you mention above (line 497 of the easy-fancybox-class.php file).

    To get it to work, we kept with your last method and in line 497 in easy-fancybox-class.php we actually changed ‘on’ to ‘bind’ and the error went away and it works!

    I really appreciate your responsiveness and help.


    Plugin Author RavanH


    Hi Jena, thanks for sharing. I take it you are you using a pre 1.7 jQuery version. Why?


    Thanks for pointing this out. 🙂

    It was accidental – I started with a blank theme template that’s a bit old, and I had thought it was set up in the functions.php to load the latest version (I’m just ‘enque-ing’ this script in my header) but apparently I had it loading a particular (old, of course) version of jquery!

    So by the directness of your question, I suppose your plugin file that I had to edit would work just fine on a current version of jquery..?

    Also, I’d like to donate to the plugin and I tried, but was a little confused (not sure if I was really in the right place, and had a little trouble trying to pay), can you give me the correct link to do so?


    Plugin Author RavanH


    Hi Jena, Yes it should work with any jQuery version 1.7+ so the one included with an up to date WordPress installation should be just fine. 🙂

    By the way, you do not need to enqueue jQuery separately. If you enqueue any script file (in your functions.php or header.php) that needs the jQuery library, just mark it as a dependency. It’s the $deps parameter on After that, WordPress will manage when to include the what.

    Also, I’d like to donate to the plugin

    Your contribution will be highly appreciated! As with any plugin in the WordPress plugin directory, there’s a “Donate to this plugin” link on the plugin page. If you go to you’ll see it on the right. Thanks 🙂

    at-least it worked for me.
    After ajax call i called


    in ajax content page.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘About that AJAX issue…’ is closed to new replies.