javascript - <body onresize="jsUpdateSize()"> not firing -


i'm learning develop sharepoint 2013. have created custom master page , added script element, seen below.

    function jsupdatesize() {         // dimensions of viewport         var width = window.outerwidth;          if (width >= 1280) {             document.getelementbyid('span_title').innerhtml = 'full title';             document.getelementbyid('span_author').innerhtml = 'full author';         } else {             document.getelementbyid('span_title').innerhtml = 'short title';             document.getelementbyid('span_author').innerhtml = 'short author';         }     }; 

this called in body tag, both onload , onresize.

<body onload="jsupdatesize()" onresize="jsupdatesize()"> 

the onload call works correctly. if change browser width , refresh page appropriate text. unfortunately not whilst re-sizing browser.

i have tried adding

window.onload = jsupdatesize;       // when page first loads window.onresize = jsupdatesize;     // when browser changes size 

unfortunately same result occurred.

i have tested script in firefox, chrome , ie. produce same results.

any advice appreciated.


Comments

Popular posts from this blog

javascript - gulp-nodemon - nodejs restart after file change - Error: listen EADDRINUSE events.js:85 -

Fatal Python error: Py_Initialize: unable to load the file system codec. ImportError: No module named 'encodings' -

javascript - oscilloscope of speaker input stops rendering after a few seconds -