0

How to compel work scripts after loading page?

"place scripts under </body>" - don't work "place scripts after </body>" - don't work. I'm tired :( Help me, please. I'm trying to do some animation and i need to find out width of my element through getComputedStyle, but it's don't work, because scripts loads before loading page. :( *crying* var menuWidth = getComputedStyle(btnStart[0].style.width, '') TypeError: failed to execute 'getComputedStyle' on 'window': parameter 1 is not of type 'element' i close to understand it. *don't crying*

28th Dec 2017, 5:17 PM
Bogdan Saliuk
Bogdan Saliuk - avatar
1 Resposta
+ 2
window.onload = function () { // your code here }
31st Dec 2017, 4:36 AM
Arif R Nas
Arif R Nas - avatar