Skip to content Skip to sidebar Skip to footer

Forcing Jquery To Run After Page Finished Loading?

So I have a small jQuery script that resizes elements according to their background image's aspect ratio. In certain instances, it doesn't work in time, and I believe this is becau

Solution 1:

Please try

    $(window).on("load", function() {
       // your logic here.
    });

Instead of

    $(document).ready(function(){...});

Note - load is called when all assets are done loading, including images. ready is fired when the DOM is ready for interaction.

Post a Comment for "Forcing Jquery To Run After Page Finished Loading?"