window.onload = function(){ if (window.innerWidth >= 320) { div.style.width = window.innerHeight + "px"; } }