The front end - page size is calculated according to the dynamic font size

1  // dynamically calculates the font size 
2 ( function () {
 . 3      var size = function () {
 . 4         // get the current screen related 
. 5          var docElement = document.documentElement;
 . 6         // three yuan comparison calculation 
. 7          var clientWidthValue = docElement.clientWidth ?> 640 640 : docElement.clientWidth;
 . 8         // according to their needs to set the font size 
. 9          docElement.style.fontSize * = 20 is (clientWidthValue / 375) + 'PX';
 10      }
 . 11      size ();
 12 is     // set 
13     window.addEventListener('resize',size);
14 })();

Reference: https: //blog.csdn.net/emperor_cj/article/details/78592447

Guess you like

Origin www.cnblogs.com/nongfusanquan/p/11718913.html