Replacing window.addEventListener with .on (IE8 fix)