Title: window.onload = function
Last modified: November 18, 2019

---

# window.onload = function

 *  Resolved [freekwp](https://wordpress.org/support/users/freekwp/)
 * (@freekwp)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/window-onload-function/)
 * 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](https://wordpress.org/support/users/gijo/)
 * (@gijo)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/window-onload-function/#post-12145125)
 * [@freekwp](https://wordpress.org/support/users/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);
       }
       ```
   
 *  Thread Starter [freekwp](https://wordpress.org/support/users/freekwp/)
 * (@freekwp)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/window-onload-function/#post-12145224)
 * 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](https://wordpress.org/support/users/gijo/)
 * (@gijo)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/window-onload-function/#post-12145557)
 * [@freekwp](https://wordpress.org/support/users/freekwp/) Thanks for pointing 
   it out. This has been fixed in v1.3.3!
 *  Thread Starter [freekwp](https://wordpress.org/support/users/freekwp/)
 * (@freekwp)
 * [6 years, 6 months ago](https://wordpress.org/support/topic/window-onload-function/#post-12145606)
 * Upgraded to 1.3.3, works like a charm!
 * Thanks Gijo!

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

The topic ‘window.onload = function’ is closed to new replies.

 * ![](https://ps.w.org/nazy-load/assets/icon-256x256.png?rev=2177344)
 * [Flying Images: Optimize and Lazy Load Images for Faster Page Speed](https://wordpress.org/plugins/nazy-load/)
 * [Support Threads](https://wordpress.org/support/plugin/nazy-load/)
 * [Active Topics](https://wordpress.org/support/plugin/nazy-load/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/nazy-load/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/nazy-load/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [freekwp](https://wordpress.org/support/users/freekwp/)
 * Last activity: [6 years, 6 months ago](https://wordpress.org/support/topic/window-onload-function/#post-12145606)
 * Status: resolved