• Resolved j.johnston

    (@jjohnston-1)


    Hi thhake,

    I have deactivated your modified “Picasa and Google Plus Express” plugin v2.2.10, which was working fine on my site, and activated your newer and more official “Photo Express for Google” plugin v0.3.2. And now PhotoSwipe won’t load. I am correctly authenticating to Google and retrieving my gallery of images, which are being properly rendered on the page (using a [peg-gallery] shortcode), but when I click on an individual image (which should launch it in PhotoSwipe) it instead just opens the image by itself in the browser window.

    I noticed the following error in my browser console on page load:
    Uncaught ReferenceError: jQuery is not defined (anonymous function) @ (index):575

    And the line in question is the first line in the following script:

    <script>
                    jQuery(document).ready(function () {
                        options = {
    	                    shareEl: true,
    	                    fullscreenEl:true,
    	                    closeEl:true,
    	                    counterEl:true                    };
                        // ready event, get a list of unique rel values for the photoswiped images
                        var rels = [];
                        var rel = '';
                        jQuery('a.photoswipe').each(function () {
                            // for each photoswipe rel, if the rel value doesn't exist yet,
                            // add it to our array
                            rel = jQuery(this).attr('rel');
                            if (rel != undefined) {
                                if (!peg_in_array(rels, rel)) {
                                    // add this rel to our array
                                    rels.push(jQuery(this).attr('rel'));
                                }
                            }
                        });
    
                        // check to see if our rels array has been built and has any values
                        if (rels.length > 0) {
                            // we have at least one individual set of unique rels, setup photoswipe
                            // for each
                            jQuery.each(rels, function (key, value) {
                                // get this rel and create the collection
    	                        initPhotoSwipeFromDOM(jQuery('a.photoswipe[rel=' + value + ']'),options)
                            });
                            //Check if there are any images without any relation (i.e. single images)
    	                    jQuery('a.photoswipe:not([rel])').each(function(key, value){
    		                    initPhotoSwipeFromDOM(jQuery(this),options);
    	                    });
                        } else {
                            // we didn't get any rels, so attempt without rel checking
    	                    initPhotoSwipeFromDOM(jQuery('a.photoswipe'),options);
                        }
    
                    });
    
                    function peg_in_array(array, value) {
                        for (var i = 0; i < array.length; i++) {
                            if (array[i] === value) {
                                return true;
                            }
                        }
                        return false;
                    }
                </script>

    Are you not including jQuery on page load? Or is something else going on? Do I need to explicitly load jQuery via another plugin?

    Thank you!

    WordPress 4.3.1 running Pictorico theme.
    Running PHP version: 5.5.28

    https://wordpress.org/plugins/photo-express-for-google/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author thhake

    (@thhake)

    Hey,

    thank you very much for this detailed bug report. You are absolutely right, I forgot to include jQuery explicitly. I didn’t notice this issue, as I only tested it with jQuery based themes.

    I’m working on a fix.

    Plugin Author thhake

    (@thhake)

    Can you give it a try with the most current version on github? I fixed it there, but can’t verify if it works locally.

    You can download it here.

    Thanks!

    Thread Starter j.johnston

    (@jjohnston-1)

    Hi thhake,

    Your fix is working nicely, and jQuery is now loading allowing PhotoSwipe to launch properly.

    Thank you very much!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Uncaught ReferenceError: jQuery is not defined’ is closed to new replies.