/
index.html
70 lines (70 loc) · 2.12 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<html class="no-js" lang="en-US">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<style>
body {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
position: relative;
}
#container{
box-sizing: border-box;
overflow: hidden;
position: relative;
}
#element {
display: block;
box-sizing: border-box;
}
#info {
position: fixed;
left: 0px;
top: 0;
z-index: 10;
padding-left: 50px;
color: white;
background: rgba(0,0,0, 0.7);
}
</style>
</head>
<body>
<div id="container">
<div id="element"></div>
</div>
<p id="info">PageScaleJS: resize page and size will be scaled in width interval [700...1400] px, window size <span id="windowsize"></span>, scale factor <span id="scalefactor" ></span> </p>
<a target="_blank" href="https://github.com/lexich/page-scale-js"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://camo.githubusercontent.com/e7bbb0521b397edbd5fe43e7f760759336b5e05f/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f677265656e5f3030373230302e706e67" alt="Fork me on GitHub" data-canonical-src="https://s3.amazonaws.com/github/ribbons/forkme_right_green_007200.png"></a>
<script src="./index.js"></script>
<script>
var el = document.getElementById("element");
var p = new PageScaleJs(el, {
width: 1400,
height: 1000,
to: 700,
onChangeScale: function(scale) {
var sel = document.getElementById("scalefactor");
if (sel) {
sel.innerHTML = "" + scale;
}
}
});
window.addEventListener("resize", update);
update();
var iframe = document.createElement("iframe");
iframe.setAttribute("src", "https://jquery.com");
iframe.setAttribute("width", "100%");
iframe.setAttribute("height", "100%");
el.appendChild(iframe);
function update() {
var wel = document.getElementById("windowsize");
if (wel) {
wel.innerHTML = "" + window.innerWidth + "x" + window.innerHeight;
}
};
</script>
</body>
</html>