• Resolved emmtqg18

    (@emmtqg18)


    Hi,

    I’ve just updated to the Pro version and am trying to use the mosaic layout for an album. I am seeing:

    Uncaught TypeError: Cannot read property 'masonry' of undefined
        at a.fn.init.<anonymous> ((index):213)
        at o (mosaic.min.js?ver=2.12:21)

    then,

    Uncaught TypeError: Cannot read property 'masonry' of undefined
        at a.fn.init.<anonymous> ((index):213)
        at o (mosaic.min.js?ver=2.12:21)
        at a.fn.init.t.fn.imagesLoaded (mosaic.min.js?ver=2.12:21)
        at doMasonry ((index):212)

    Errors and the album doesn’t load. Thanks for any pointers!

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

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Serhii Pasyuk

    (@pasyuk)

    Seems like your theme missed required wp_footer(); function in footer.php file.
    Read more: https://codex.ww.wp.xz.cn/Function_Reference/wp_footer

    Always have wp_footer() just before the closing </body> tag of your theme, or you will break many plugins, which generally use this hook to reference JavaScript files.

    Thread Starter emmtqg18

    (@emmtqg18)

    Hi,

    Thanks so much for the quick response! I looked at the source, and the footer is included. Looking at chrome developer, it does look like it’s including the minified <script type=”text/javascript” src=”https://www.catherinegray.ie/wp-includes/js/jquery/jquery.masonry.min.js?ver=3.1.2b”></script&gt; file.

    The versions listed on the sources are:
    masonry.min.js?ver=3.3.2
    jquery/jquery.masonry.min.js?ver=3.1.2b

    The theme source does call wp_footer() in its footer.php file. I appreciate you thinking at this! Thank you!
    Liz

    Plugin Author Serhii Pasyuk

    (@pasyuk)

    I see that your theme or some plugin adds this script:

    <script>
        
        jQuery(document).ready(function ($) {
    
        /*
            * Handle Blog Roll Masonry
            */
        function doMasonry() {
    
            var $grid = $( "#masonry-blog-wrapper" ).imagesLoaded(function () {
                $grid.masonry({
                    itemSelector: '.blog-roll-item',
                    columnWidth: '.grid-sizer',
                    percentPosition: true,
                    gutter: '.gutter-sizer',
                    transitionDuration: '.75s'
                });
            });
            
            
                if ( $( window ).width() >= 768 ) {
    
                    $('.blog #masonry-blog-wrapper .gutter-sizer').css('width', '2%');
                    $('.blog #masonry-blog-wrapper .grid-sizer').css('width', '49%');
                    $('.blog #masonry-blog-wrapper .blog-roll-item').css('width', '49%');
    
                } else {
    
                    $('.blog #masonry-blog-wrapper .gutter-sizer').css('width', '0%');
                    $('.blog #masonry-blog-wrapper .grid-sizer').css('width', '100%');
                    $('.blog #masonry-blog-wrapper .blog-roll-item').css('width', '100%');
    
                }
                
                            
            if ( $( window ).width() >= 992 ) {  
    
                $('.home.blog #masonry-blog-wrapper .gutter-sizer').css('width', '2%');
                $('.home.blog #masonry-blog-wrapper .grid-sizer').css('width', '32%');
                $('.home.blog #masonry-blog-wrapper .blog-roll-item').css('width', '32%');
    
            } else if ( $( window ).width() < 992 && $( window ).width() >= 768 ) {
    
                $('.home.blog #masonry-blog-wrapper .gutter-sizer').css('width', '2%');
                $('.home.blog #masonry-blog-wrapper .grid-sizer').css('width', '49%');
                $('.home.blog #masonry-blog-wrapper .blog-roll-item').css('width', '49%');
    
            } else {
    
                $('.home.blog #masonry-blog-wrapper .gutter-sizer').css('width', '0%');
                $('.home.blog #masonry-blog-wrapper .grid-sizer').css('width', '100%');
                $('.home.blog #masonry-blog-wrapper .blog-roll-item').css('width', '100%');
    
            }
    
        }
    
        /**
        * Call Masonry on window resize and load
        */
        $( window ).resize( function() {
            doMasonry();
        });
        doMasonry();
    
                        
        });
            
    </script>

    This script conflicts with Gmedia Gallery script, because they both trying to build galleries from the same images when they are loaded.

    Thread Starter emmtqg18

    (@emmtqg18)

    Thanks again for your responsiveness! I disabled the theme’s gallery and am still getting that script included.

    I wasn’t seeing this error before I got the gmedia pro version and used the phantom template. I know the 2 different versions of masonry.js listed above couldn’t be right – which one is used gmedia? If I can rename the conflicting script (because I can’t determine from cpanel who’s including it) – will that do? I am not using the blog right now (just pages) so don’t need what seems to be the ‘.home.blog #masonry-blog-wrapper’ – I’m using a static home page. I realize this is on the theme’s side of things.

    Thank you so much!
    Liz

    Thread Starter emmtqg18

    (@emmtqg18)

    Hello =

    I downloaded the site and debugged – I just added a test around the code that was failing in my theme’s loading page. Thank you for your quick responses to all my inquiries!

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

The topic ‘js errors on loading mosaic album’ is closed to new replies.