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++ - protocol buffers - generate NON-inline accessors -

c# - issue attaching/adding an entity object which is detached from the DB Context? -