• Stefan

    (@kalevskis)


    Hello there,

    I get this error in console:
    https://monosnap.com/file/NqIzL6xzvplXaoriHjYbnSoNaW3l6g

    for this part of the code which being loaded in head of the page:

    
    jQuery(document).ready(function ($) {
        // lazy load
        if ('') {
            jQuery.extend(jQuery.lazyLoadXT, {
                srcAttr: 'data-src',
                visibleOnly: false,
                updateEvent: 'load orientationchange resize scroll touchmove focus hover'
            });
        }
    
        // woocommerce lightbox/zoom
        disableClick($);
    
        // for all images at single product page
        setTimeout(function () {
            resizeImg($);
            jQuery('a.woocommerce-product-gallery__trigger').css('visibility', 'visible');
        }, 2500);
    });
    
    jQuery(window).on('ajaxComplete', function () {
        if ('') {
            setTimeout(function () {
                jQuery(window).lazyLoadXT();
            }, 300);
        }
    });
    
    jQuery(window).on('load', function () {
        jQuery('.flex-viewport').css('height', '100%');
    });
    
    function resizeImg($) {
        var imgSelector = ".post img, .page img, .widget-content img, .product img, .wp-admin img, .tax-product_cat img, .fifu img";
        var resizeImage = function (sSel) {
            jQuery(sSel).each(function () {
                //original size
                var width = $(this)['0'].naturalWidth;
                var height = $(this)['0'].naturalHeight;
                jQuery(this).attr('data-large_image_width', width);
                jQuery(this).attr('data-large_image_height', height);
    
                //100%
                //var ratio = width / height;
                //jQuery(this).attr('data-large_image_width', jQuery(window).width() * ratio);
                //jQuery(this).attr('data-large_image_height', jQuery(window).width());
            });
        };
        resizeImage(imgSelector);
    }
    
    function disableClick($) {
        if ('1') {
            jQuery('.woocommerce-product-gallery__image').each(function (index) {
                jQuery(this).children().click(function () {
                    return false;
                });
                jQuery(this).children().children().css("cursor", "default");
            });
        }
    }
    

    Woocommerce settings were enabled in settings, but now I have disabled them and above part of code is still being loaded:
    https://monosnap.com/file/DDSgvhApUXDhKFJ8VyF5AB99vRrMjr

    Could you please help on this problem?

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

    (@marceljm)

    Hi @kalevskis.

    jQuery is a JavaScript library that is already installed on WordPress by default (you don’t need to install any plugin for that).

    So if you have this error there is a problem on your installation.

    The FIFU Lazy Load feature uses jQuery. So you can “solve” the message problem disabling this feature.

    Thread Starter Stefan

    (@kalevskis)

    Hello @marceljm ,

    Thank you very much for fast answer.

    I have already disabled the Lazy Load feature inside FIFU:
    https://monosnap.com/file/yUhzj4BA4cpnKMHZZ3rqxY0SHjFah1

    I am confused why the above mentioned code is still being loaded?

    Plugin Author Marcel

    (@marceljm)

    Okay. Maybe it won’t help you. Some jQuery code is used to initialize some Lazy Load events.

    So there is only two ways to solve that:
    1) you should identify what’s removing the jQuery library of your site (it can be any plugin)
    2) I add a feature to load jQuery library if don’t have it (it will take two weeks)

    What to you prefer?

    Thread Starter Stefan

    (@kalevskis)

    The Jquery plugin is being loaded by W3 Cache (manual minification). So neither of your solutions would work unfortunately. There must be some other way to overcome this? I thought removing that piece of code would fix it as I really don’t need. Lazy loading is already done by W3 Cache.

    Plugin Author Marcel

    (@marceljm)

    I will try to install W3 and simulate your issue. Since its minifying jQuery it can be the cause of your problem. I’m on a trip now, without my computer, but I should contact you next week.

    FIFU premium has a feature to add jQuery if that’s missing. In the worst scenario I can try to add that to the free version too.

    Plugin Author Marcel

    (@marceljm)

    Hi, @kalevskis.

    I’m back. In FIFU 2.7.3 there will be a jQuery toggle at FIFU Settings > Admin Area. It should be released in 3 days.

    This week I’m going to analyse your issue with W3 too.

    Plugin Author Marcel

    (@marceljm)

    Hi, @kalevskis.

    The version 2.7.3 was released. Please enable the jQuery toggle and let me know if that solves your issue.

    Thread Starter Stefan

    (@kalevskis)

    Hello @marceljm ,

    thanks a lot for putting efforts to help with this issue. Unfortunately, it seems you haven’t understood me. I don’t have problems with missing jQuery, because it is being loaded but at the bottom of the page with defer loading and inside W3 Total Cache minified file. I did this because I had to improve page speed for my website. Therefore, the solution to again load JQuery is not a solution for me.

    The problem is the above mentioned part of the code, which is being inserted in head of each page of my website. I really don’t need that part of code because I don’t have Woocommerce script neither I need any LazyLoading and similar effects. I think you have different problem, especially since I have disabled all Woocommerce settings inside your script (Lighbox and Zoom effects).

    Plugin Author Marcel

    (@marceljm)

    “I don’t have problems with missing jQuery”
    Well, “Uncaught ReferenceError: jQuery is not defined” is the title of your ticket.

    “I really don’t need that part of code because I don’t have Woocommerce script neither I need any LazyLoading and similar effects.”
    So in you case the scripts will be partially executed, only to check if the rest of the code should run or not. It shouldn’t cause troubles or delays. Or am I wrong?

    Moreover, if you take a look at any js library, such as jQuery, there are hundreds of functions that are being loaded by your site but are never used.

    Anyway, this week I will install W3 and check if there are any conflict with FIFU.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Uncaught ReferenceError: jQuery is not defined’ is closed to new replies.