Skip to content

Commit f12f850

Browse files
Merge pull request #214 from positivecrash/main
iframe expand
2 parents 660d160 + 701c7c5 commit f12f850

File tree

1 file changed

+65
-2
lines changed

1 file changed

+65
-2
lines changed

src/pages/demoapps/johnnyb-lab.vue

Lines changed: 65 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,14 @@
2323
</section>
2424

2525
<section class="container__mid">
26-
<iframe id="appframe" src="https://johnnyb-lab.robonomics.academy" sandbox="allow-forms allow-scripts allow-same-origin" />
27-
<!-- <iframe id="appframe" src="https://johnnyb-lab.robonomics.academy" sandbox="allow-forms allow-scripts allow-same-origin" referrerpolicy="strict-origin-when-cross-origin" scrolling="no" /> -->
26+
<div class="iframecontainer">
27+
<div class="iframecontrols">
28+
<a href="javascript:;" @click.prevent="expand" v-if="!expanded">Expand application</a>
29+
<a href="javascript:;" @click.prevent="collapse" v-if="expanded">Collapse application</a>
30+
</div>
31+
<iframe id="appframe" src="https://johnnyb-lab.robonomics.academy" sandbox="allow-forms allow-scripts allow-same-origin" />
32+
<!-- <iframe id="appframe" src="https://johnnyb-lab.robonomics.academy" sandbox="allow-forms allow-scripts allow-same-origin" referrerpolicy="strict-origin-when-cross-origin" scrolling="no" /> -->
33+
</div>
2834
</section>
2935
</Layout>
3036
</template>
@@ -37,6 +43,12 @@ export default {
3743
MetaInfo: () => import('~/components/MetaInfo.vue')
3844
},
3945
46+
data() {
47+
return {
48+
expanded: false,
49+
}
50+
},
51+
4052
methods: {
4153
resizeIframe() {
4254
if (typeof document !== 'undefined') {
@@ -52,6 +64,22 @@ export default {
5264
// console.log(e);
5365
}
5466
}
67+
},
68+
69+
expand() {
70+
const iframe = document.querySelector(".iframecontainer");
71+
if(iframe) {
72+
iframe.classList.add('expanded');
73+
this.expanded = true;
74+
}
75+
},
76+
77+
collapse() {
78+
const iframe = document.querySelector(".iframecontainer");
79+
if(iframe) {
80+
iframe.classList.remove('expanded');
81+
this.expanded = false;
82+
}
5583
}
5684
},
5785
@@ -74,4 +102,39 @@ iframe {
74102
height: 1100px;
75103
border: 0;
76104
}
105+
106+
.iframecontainer {
107+
position: relative;
108+
}
109+
110+
.iframecontainer.expanded {
111+
position: fixed;
112+
top: 100px;
113+
left: 0;
114+
right: 0;
115+
bottom: 0;
116+
height: calc(100vh - 30px);
117+
z-index: 100;
118+
}
119+
120+
.iframecontainer.expanded iframe {
121+
position: absolute;
122+
top: 40px;
123+
left: 0;
124+
right: 0;
125+
bottom: 0;
126+
height: calc(100% - 110px);
127+
}
128+
129+
.iframecontrols {
130+
text-align: right;
131+
}
132+
133+
.iframecontrols a {
134+
display: inline-block;
135+
background: var(--color-main);
136+
padding: 5px 20px;
137+
color: var(--color-text);
138+
font-weight: bold;
139+
}
77140
</style>

0 commit comments

Comments
 (0)