scale2078

Scale you paye by the width

此脚本不应直接安装,它是一个供其他脚本使用的外部库。如果您需要使用该库,请在脚本元属性加入:// @require https://update.cn-greasyfork.org/scripts/491239/1351475/scale2078.js

  1. function adjustScale() {
  2. const baseWidth = 1000;
  3. const viewportWidth = window.innerWidth;
  4. const scale = baseWidth / viewportWidth;
  5.  
  6.  
  7. const body = document.body;
  8. const home = document.getElementById("Home");
  9.  
  10. body.style.transform = `scale(0.${scale})`;
  11. body.style.transformOrigin = 'top left';
  12. body.style.width = `100vw`;
  13. body.style.minHeight = '100vh';
  14. home.style.position = 'relative';
  15. home.style.left = '10vw';
  16. home.style.width = '80vw';
  17. }
  18.  
  19. window.addEventListener('load', adjustScale);
  20. window.addEventListener('resize', adjustScale);