(function (doc, win) { var docel = doc.documentelement, resizeevt = 'orientationchange' in window ? 'orientationchange' : 'resize', recalc = function () { var clientwidth = docel.clientwidth; if (!clientwidth) return; clientwidth = (clientwidth > 768 ) ? 768 : clientwidth ; docel.style.fontsize = 10 * (clientwidth / 375 ) + 'px'; }; if (!doc.addeventlistener) return; win.addeventlistener(resizeevt, recalc, false); recalc(); })(document, window);