Support » Plugin: Flying Images by WP Speed Matters » window.onload = function

  • Resolved freekwp

    (@freekwp)


    Hi Gijo,

    Great work on this plugin! Smoothest lazy loading I’ve come across.

    I’ve run into the following issue that had me temporarily disable the plugin.

    I have a number of pages where I’m loading some page specific Javascript using:

    windown.onload = function

    It seems that flying images is also using this and thus my Javascript isn’t being run. I can resolve the issue either by disabling Flying Images or by using

    jQuery(document).ready(function()

    in my code instead (which is quite a bit of work for me though, seeing as this is an issue on multiple pages).

    I imagine other people might run into this as well, so I was hoping you might address this in an update.

    Cheers!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Gijo Varghese

    (@gijo)

    @freekwp Hi,

    Flying Pages starts execution on:

    document.addEventListener("DOMContentLoaded", function() {
      flyingImages();
    });

    I can move the code to jQuery(document).ready(function() but there are sites that don’t use jQuery. So it will cause issues.

    But I didn’t get the errors occurred. Both should work. Here is an example:

    document.addEventListener("DOMContentLoaded", function() {
      console.log(1);
    });
    
    window.onload = function () {
     console.log(2);
    }
    freekwp

    (@freekwp)

    Hi Gijo,

    Thanks for checking this out!

    I took another look at and it seems the second line here might be causing the conflict:

    const dynamicContentObserver = new MutationObserver(throttle(flyingImages, 125));
    window.onload = function() {
        dynamicContentObserver.observe(document.body, {
            attributes: !0,
            childList: !0,
            subtree: !0
        })
    }

    Could that be the case?

    Cheers!

    Plugin Author Gijo Varghese

    (@gijo)

    @freekwp Thanks for pointing it out. This has been fixed in v1.3.3!

    freekwp

    (@freekwp)

    Upgraded to 1.3.3, works like a charm!

    Thanks Gijo!

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