reset.js 880 B

123456789101112131415161718192021222324
  1. window.onload=function(){
  2. var u = navigator.userAgent,
  3. dpr = window.devicePixelRatio || 1;
  4. if (u && u != "") {
  5. var mobile = !!u.match(/AppleWebKit.*Mobile.*/); //是否为移动终端
  6. if(mobile){
  7. if(dpr==2){
  8. document.documentElement.style.fontSize="100%";
  9. }else if(dpr==1.5){
  10. document.documentElement.style.fontSize="120%";
  11. }else if(dpr==3){
  12. document.documentElement.style.fontSize="130%";
  13. }
  14. document.documentElement.setAttribute('mobile','1');
  15. }
  16. }
  17. document.documentElement.setAttribute('dpr',dpr);
  18. //alert(dpr)
  19. //console.log(window.location.pathname);
  20. var pathName = window.location.pathname;
  21. if(pathName.indexOf("header")>0){
  22. //_header.document.getElementById(pathName).className='active';
  23. }
  24. }