var zoom = window.devicePixelRatio || window.screen.deviceXDPI / window.screen.logicalXDPI;; console.log(zoom); fontSize(); $(window).resize(function() { fontSize(); }); function fontSize() { var size; var winW = window.innerWidth; if (winW <= 1600 && winW > 800) { size = Math.round(winW / 16); } else if (winW <= 800) { size = Math.round(winW / 7.5); if (size > 65) { size = 65; } } else { size = 100; } $('html').css({ 'font-size': size + 'px' }) // if (zoom == 1.25) { // $('html').css({ 'font-size': size / 1.2 + 'px' }) // } else if (zoom == 1.5) { // $('html').css({ 'font-size': size / 1.4 + 'px' }) // } else { // $('html').css({ 'font-size': size + 'px' }) // } if (zoom == 1.25) { $('html').addClass('zoom125') } else if (zoom == 1.5) { $('html').addClass('zoom150') } }