Take your website
To the next level
Discover our newly launched customization services and elevate your web projects to new heights.
Delegate tasks, save time, and unlock the power of professional WordPress outsourcing.

Okay
  Public Ticket #2552012
Excluding from Lazyloading
Closed

Comments

  • jamsessionein started the conversation

    Is there a way to utilize the theme's Lazy-loading feature, but exclude certain media, classes, or other selections? I have an elementor grid panel gallery that I want to use, but if I toggle Lazy Loading on, it fails to load properly, so I'd like to exclude just that container, those images, or the pages in question. 

  •  7,122
    Oliver replied

    Hi,

    Can you provide wp-admin access? Where do you activate lazy loading? 


    Please note if you comment on your ticket before we reply, your ticket will be pushed down of the tickets list. 

    Regards, Oliver

  •   jamsessionein replied privately
  • jamsessionein replied

    I feel like I'm close to having this figured, but not quite there yet.

    Looking through /inc/pagespeed/lazy-items.class.php there's sections regarding ignoring blocks with the tgpQueue script, which seems to be what's breaking the panel gallery I wanted to use. Is there a way to set an element attribute (I see 'TGM_PAGESPEED_LAZY_ITEMS_INORED_BLOCK_' in here) to be exempted from the theme lazyloading?

    There's a processIgnoredBlocks function in here but honestly I can't interpret the regex worth a damn to figure out what it's digging for. 

  • jamsessionein replied

    Looks like thegem-pagespeed-lazy-items.js has a check on ignoring a group of elements.

            isIgnoreGroup: function(group) {
                if (group.getType() == 'gem-slideshow' || group.getType() == 'rev_slider') {
                    return true;
                }

    By going into Elementor, picking the Grid Panel Gallery, going to attributes, and adding 'type|gem-slideshow' to the attributes on the widget it seems to be exempted from the lazyloading and goes back to working, so I guess I have a workaround.

    That said, is there a, uh, cleaner way of doing this than telling the theme 'yeah this element here is totally a gem-slideshow, ignore it'? I guess I could edit the .js to add more conditions to be ignored, but that'd break whenever the theme updates, so that seems less than ideal.

  • jamsessionein replied

    It's weird - even that fix seems inconsistent. I have some pages where I've put that attribute in and it still tries to hit them with the lazyloading. I feel like I'm missing some other variable here, but I haven't a clue what. 

    The two pages in question, for comparison:

    http://proto.fusedcreations.com/hire-me/titanfall-replica-data-knife/

    http://proto.fusedcreations.com/hire-me/ffxiv-malignant-mogaxe/

    Edit: It seems to be related to the particular images the grid panel gallery has. If I take the working page (Mogaxe) and put the images in it from the Data Knife page, for some reason the page optimization options from TheGem theme adds back in the window.tgpQueue.add('tgpli-5f7249853d6a7') script, which breaks the gallery, even with the 'gem-slideshow' attribute added and nothing else changed.

    On a debugging hunch I deactivated Optimole, which is an image optimization plugin (mostly using it for WebP), but that hasn't affected anything.

    Any ideas? 

  •  7,122
    Oliver replied

    Hi,

    As you know in the WordPress 5.5 version lazyloading enabled in the WP core, so you can deactivate gem images optimization... (after you deactivated it everything is ok?)

    https://wordpress.org/support/wordpress-version/version-5-5/

    Please note if you comment on your ticket before we reply, your ticket will be pushed down of the tickets list. 

    Regards, Oliver

  • jamsessionein replied

    Well, yeah. If I deactivate the theme's image optimization, things work. I know WP5.5 has that support, I didn't know if it was as robust as what the theme was advertising it offered, but if the solution is just not to use the theme's feature then I guess I can do that.  

  •  7,122
    Oliver replied

    Hi,

    There won't be difference. 

    Please note if you comment on your ticket before we reply, your ticket will be pushed down of the tickets list. 

    Regards, Oliver