please move it below windowWidth = window.innerWidth;

and add a comment why it was done