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
Post a Comment