-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathresponsive-iframe-element.html
55 lines (51 loc) · 1.5 KB
/
responsive-iframe-element.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
<link rel="import" href="../polymer/polymer.html">
<dom-module id="responsive-iframe-element">
<template>
<style>
:host {
height: 100%;
}
.wrapper {
width: var(--responsive-iframe-wrapper-width, 100%);
height: 100%;
margin: 0 auto;
}
.h_iframe {
position: relative;
}
.h_iframe .ratio {
display: block;
width: 100%;
height: auto;
}
.h_iframe iframe {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
</style>
<div class="wrapper">
<div class="h_iframe">
<img class="ratio" src="http://placehold.it/16x9"/>
<iframe src="[[source]]" sandbox="[[restrictions]]" frameborder="0"></iframe>
</div>
</div>
</template>
<script>
Polymer({
is: 'responsive-iframe-element',
properties: {
source: {
type: String,
value: 'http://www.youtube.com/embed/fFF2Yup2dMM'
},
restrictions: {
type: String,
value: 'allow-forms allow-popup allow-scripts allow-same-origin allow-modals'
}
}
});
</script>
</dom-module>