Add the html loading ready in Javascript.
There is a standards based replacement,DOMContentLoaded that is supported by over 98% of browsers, though not IE8.
document.addEventListener("DOMContentLoaded", function(event) {
// Do something.
});
This equals the below.
$(document).ready({
// Do something.
});