Viewing 8 replies - 1 through 8 (of 8 total)
  • Hi mstookey, the content is loaded via ajax by your theme. All content loaded after the first ‘document.ready’ is not scanned by the FancyBox script. Unless you fire that script manually. This can be done by editing the file /wp-content/themes/minimum/js/ajax.js (open it in the WordPress theme editor) and find the function function loadResource(url). Then, inside that function you will see a part like this (dots represent multiple lines of script code) :

    ...
    	$j.ajax({
    		url: root+url,
    		dataType: 'html',
    		async : true,
    		success: function (text, status, request) {
    			function insertNewPage () {
    ...
    			}
    			insertNewPage();
    
    			document.location.href = root + '#/' + url;
    
    		},
    ...

    Now on the blank line right after document.location.href = root + '#/' + url; paste this code:

    $j(document).trigger('gform_post_render');

    From now on, the FancyBox script will refire after each new content is loaded.

    Thread Starter mstookey

    (@mstookey)

    That did it! YOU ROCK.
    Thank you so much for the quick reply. You have a great plugin & I will certainly use your donate button!

    Much appreciated 🙂

    Thread Starter mstookey

    (@mstookey)

    Hmm… I’m not sure it’s working correctly after all. I’ve cleared my cached & even looked at it on a different computer & the first time you go to any of the pages in that portfolio section, fancybox doesn’t work, the image appears in a separate window. If I do a super refresh on the page, then it works. But then when i navigate to another portfolio section, or even back to that page it doesn’t work correctly the first time. Tried it on another computer & it’s not working either.

    Here is the page: http://www.perennialgardens.net/#/?page_id=3863

    Thread Starter mstookey

    (@mstookey)

    I had a few poeople try it on other computers & it wasn’t working. (It would if you did a super refresh on that page but it only worked while on that page… if you navigated to another it stopped working) And to complicate things further, my theme was just updated & the ajax.js script changed, including that section you had me update. They have now commented out this line:

    document.location.href = root + ‘#/’ + url;

    Currently I have the updated version installed without your additions. Any suggestions welcome. thanks.

    Hi mstookey, I see they have replaced the ajax.js with ajax.min.js which is a ‘minified’ (compacted) version. This makes it a bit harder editing the file but is should still be possible…

    Open ajax.min.js in the WordPress theme editor and with Ctrl+F do a search for href=root to find the part where it reads:

    ...}else{document.location.href=root+'#/'+url}}

    Now replace those last two }} with

    };$j(document).trigger('gform_post_render');}

    Thread Starter mstookey

    (@mstookey)

    Hi RavanH,
    Thanks for your response. That helped & does work occasionally but if you navigate through the Portfolio section you’ll see it doesn’t work correctly every time, most times it just opens in another window. Maybe I should contact the template developer?

    Ok, that would mean the script does not always reach the point where we inserted our code snippet. Either we need to find a better place for it or insert the same code elsewhere too…

    Try moving the code snippet (leaving the two }} as before again) and place it between insertNewPage(); and firstLoad=false; (just before where it used to be) so it looks like this

    ...}insertNewPage();$j(document).trigger('gform_post_render');firstLoad=false;...

    Otherwise, if you can get info from the theme developer on where to put it so it gets triggered on each new content, then that would be great 🙂

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Fancybox not working after updates’ is closed to new replies.