You can use
$(window).on('load', function() {
// your code here
});
Which will wait until the page is loaded. $(document).ready() waits until the DOM is loaded.
In plain JS:
window.addEventListener('load', function() {
// your code here
})