PageSourceSearch

https://www.jcqzw.com/xtwj/js/flexible.js?v=20260629

js jcqzw.com collected 2026-10-08 19:04:20 UTC 1,601 bytes, 51 lines download raw bytes

1//author:caibaojian
2//兼容UC竖屏转横屏出现的BUG
3//自定义设计稿的宽度:designWidth
4//最大宽度:maxWidth
5//这段js的最后面有两个参数记得要设置,一个为设计稿实际宽度,一个为制作稿最大宽度,例如设计稿为828,最大宽度为828,则为(828,828)
6;(function(designWidth, maxWidth) {
7	var doc = document,
8	win = window,
9	docEl = doc.documentElement,
10	remStyle = document.createElement("style"),
11	tid;
12
13	function refreshRem() {
14		var width = docEl.getBoundingClientRect().width;
15		maxWidth = maxWidth || 540;
16		width>maxWidth && (width=maxWidth);
17		var rem = width * 100 / designWidth;
18		remStyle.innerHTML = 'html{font-size:' + rem + 'px;}';
19	}
20
21	if (docEl.firstElementChild) {
22		docEl.firstElementChild.appendChild(remStyle);
23	} else {
24		var wrap = doc.createElement("div");
25		wrap.appendChild(remStyle);
26		doc.write(wrap.innerHTML);
27		wrap = null;
28	}
29	//要等 wiewport 设置好后才能执行 refreshRem,不然 refreshRem 会执行2次;
30	refreshRem();
31
32	win.addEventListener("resize", function() {
33		clearTimeout(tid); //防止执行两次
34		tid = setTimeout(refreshRem, 300);
35	}, false);
36
37	win.addEventListener("pageshow", function(e) {
38		if (e.persisted) { // 浏览器后退的时候重新计算
39			clearTimeout(tid);
40			tid = setTimeout(refreshRem, 300);
41		}
42	}, false);
43
44	if (doc.readyState === "complete") {
45		doc.body.style.fontSize = "16px";
46	} else {
47		doc.addEventListener("DOMContentLoaded", function(e) {
48			doc.body.style.fontSize = "16px";
49		}, false);
50	}
51})(750, 750);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.