-
Notifications
You must be signed in to change notification settings - Fork 20
/
embedded.html
38 lines (36 loc) · 1.37 KB
/
embedded.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
<html>
<body>
<div>
<input type="button" class="sizeButton" value="320x240" data-width="320px" data-height="240px">
<input type="button" class="sizeButton" value="420x315" data-width="420px" data-height="315px">
<input type="button" class="sizeButton" value="640x480" data-width="640px" data-height="480px">
<input type="button" class="sizeButton" value="800x600" data-width="800px" data-height="600px">
</div>
<iframe src="index.html?bypasslanding=1&render=canvas"
allowfullscreen webkitallowfullscreen mozallowfullscreen
width='320' height='240'>
</iframe>
<div style="height:1024px; background-color: lightyellow">
dummy div 1024px height to create a scrollable page
</div>
<script>
var bindInput = function(){
var elements = document.body.getElementsByClassName("sizeButton");
for(var i = 0; i < elements.length; i ++){
var element = elements[i];
element.addEventListener("click", function(event){
// get dimension from element
var element = event.target;
var width = element.getAttribute('data-width');
var height = element.getAttribute('data-height');
// set iframe dimension
var iframe = document.body.getElementsByTagName('iframe')[0];
iframe.setAttribute('width' , width);
iframe.setAttribute('height' , height);
}, false);
}
}
bindInput();
</script>
</body>
</html>