olivebot/gui/static/js/self-adaption.js
xszyou 875ed28b58 初始上传
初始上传
2023-12-12 00:03:36 +08:00

25 lines
810 B
JavaScript

window.onload = function () {
document.body.style.zoom = "normal";//避免zoom尺寸叠加
let scale = document.body.clientWidth / 1920;
document.body.style.zoom = scale;
}; (function () {
var throttle = function (type, name, obj) {
obj = obj || window;
var running = false;
var func = function () {
if (running) { return; }
running = true;
requestAnimationFrame(function () {
obj.dispatchEvent(new CustomEvent(name));
running = false;
});
};
obj.addEventListener(type, func);
};
throttle("resize", "optimizedResize");
})();
window.addEventListener("optimizedResize", function () {
document.body.style.zoom = "normal";
let scale = document.body.clientWidth / 1920;
document.body.style.zoom = scale;
});