The only way i can achieve a result i wanted is to load in the head section domready plugin like
https://github.com/freelancephp/DOMReady
or
https://github.com/requirejs/domReady
domready plugin or attaching events should always be ran before actual browser domready event occurs otherwise all of them are waiting for all images to be loaded and that is not what you want.