javascript window.onresize on page load -


i have script shows different content depending on screen size, looks this:

window.onresize = function(event) { if ((window.innerwidth > 750 && window.innerwidth < 1250))  {  //do  }} 

the above works absolutely fine when re-sizing browser. question how can above work if user opens page window width of 750?

i have tested , event isn't triggered until browser re-sized, causing above not work

var onresizing = function(event) { if ((window.innerwidth > 750 && window.innerwidth < 1250))  {  //do  }};  window.onresize = onresizing; window.onload = onresizing; 

Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -