scale2078

Scale you paye by the width

此腳本不應該直接安裝,它是一個供其他腳本使用的函式庫。欲使用本函式庫,請在腳本 metadata 寫上: // @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);