Support » Plugin: EWWW Image Optimizer » JS WebP + Infinite scrolling

  • Resolved Will Stocks

    (@willstockstech)


    Hello again

    I found another slightly strange bit of behaviour – I have a “click to infinite scroll” implementation on my theme (it was that, or pure infinite scrolling) using Metafizzy’s Infinite Scroll package (v3.0.3) and I have noticed that when a new page/set of posts is infinite scrolled in (categories or homepage), the JS WebP doesn’t seem to correctly apply and all of the standard .jpeg/jpg/png images are requested instead. Is there anything I can/need to do around this?

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

    (@nosilver4u)

    Infinite scroll functions often use requests to admin-ajax.php to load additional content. Unfortunately, WordPress considers that part of the WP Admin, and the plugin won’t run JS WebP parsing on admin requests…

    Of course, there are other plugins that do infinite scroll, and we can add exclusions for those particular admin-ajax.php requests.

    Let me know what page it is happening on, and I’ll check to see what info we need to add an exclusion for it.

    Will Stocks

    (@willstockstech)

    So the page in question is: https://willstocks.co.uk

    Scroll to the bottom and click “Load More”

    Same as when you visit that page, head to the menu and click on one of the categories – the same happens there.

    I’m away from my computer so can’t check if it’s admin-ajax being called or not (off of the top of my head, I feel like it’s not… but I can’t be sure 😂)

    Will Stocks

    (@willstockstech)

    So, it’s actually making an XHR request for the requested page (I’ve just managed to get back infront of my computer), not via admin-ajax.
    My site uses the packaged implementation, not the WP Plugin version.

    Plugin Author nosilver4u

    (@nosilver4u)

    Hmm, that’s odd JS WebP isn’t kicking in then, I’ll take a closer look at that tomorrow.

    Plugin Author nosilver4u

    (@nosilver4u)

    So it appears that JS WebP is parsing the page, but for some reason the “unveilhook” for WebP to connect with lazysizes isn’t firing correctly. That much would make sense if you’re still using your custom lazysizes script.
    But then the “arrive” listener for JS WebP doesn’t seem to be making a connection there either.

    So that I can try to replicate it, did you create a plugin yourself for infinite scroll, or did you just integrate it within your theme?
    In either case, if you can zip up the theme/plugin folder so that I can drop it into my dev site, I’ll give it a shot and see where the break-down is happening.

    Forgot to say, you can send the zip (or a link) via the contact form https://ewww.io/contact-us/

    • This reply was modified 1 month ago by  nosilver4u.
    Will Stocks

    (@willstockstech)

    Very interesting… the lazysizes script implementation is fairly standard and I include unveilhooks: https://willstocks.co.uk/wp-content/themes/linx-child/js/ws-lazysizes.js

    I will zip up and send over my theme for you to review as the metafizzy infinite scroll is tied in with the theme (nothing too bespoke as far as I’m aware).

    Will Stocks

    (@willstockstech)

    Theme zipped and just sent over (the contact page confused me for a sec, before I realised it was the “chat” bubble in the bottom right, lol!)

    Shout if you need any other info. You should have my email now as well, so feel free to ping an email if required

    Plugin Author nosilver4u

    (@nosilver4u)

    I’ve fixed the lazy + webp + infinite scroll issue, per the email I just sent.

    Will Stocks

    (@willstockstech)

    Just had a chance to deploy – can confirm resolved 😀

Viewing 9 replies - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.