Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Full Screen Iframe

I am looking for a CSS solution that will let me to display a few horizontal full-screen iframes in one page.

I can do the jQuery myself, I just need couple of iframes to be in one page so I can click 'next' and the next iframe will be full screen. (So the iframes should be floated)

Thanks!

like image 469
AdamGold Avatar asked May 27 '11 13:05

AdamGold


People also ask

Can iframe go fullscreen?

You can add allowfullscreen attribute to the iframe so that you can click fullscreen button in the HTML5 player toolbar to go fullscreen.

How do I make my iframe height 100%?

given the iframe is directly under body. If the iframe has a parent between itself and the body, the iframe will still get the height of its parent. One must explicitly set the height of every parent to 100% as well (if that's what one wants).

Can you resize iframe?

iFrames let you embed external content, such as YouTube videos, advertisements, and content from other sites into your own web page. You can easily resize iFrames using HTML and/or CSS, and even make them resizable so they'll adjust automatically based on the user's screen size.


1 Answers

Use iframeclass on the iframes to make them appear on top of each other, then use jQuery to set the z-index to show which is "on top"

.iframeclass {
    position: absolute;
    top: 0; left: 0;
    width:100%;
    height:100%;
}

note: in order for height: 100%; to work, the PARENT object must have a height set. ie:

body {
    height:100%;
}

Second note, please be aware that whilst this answers your question, its not how I'd recommend doing what I think you are trying to achieve, I'd recommend loading each frame's content into a single div with ajax as and when you need it. The iframes will ALL load their content on page load.

like image 96
Matt.C Avatar answered Sep 30 '22 05:09

Matt.C