I have a chrome extension that shows a menu on the right side of the page, consisting of a few buttons that are 47px wide each. Because of this, the width of the iframe is also set at 47 px.
However, when a button is clicked, I want to show a dropdown (or 'dropleft' as you could say) which of course is wider than the 47px. Currently this content is cut off at the edge of the iframe.
I would prefer to be able to control all this from the iframe, so that I don't have to update the extension whenever I want to change something. Is there a way to overlay content from the iframe on the website below?
EDIT
I don't think resizing the iframe would be the solution. The div with additional information would e.g. be 400x200 pixels. If I'd just increase the size of the iframe, there would be transparent parts which would show the underlaying website but wouldn't be clickable. Ideally, the content from the iframe would just overlay from the existing iframe size.
Function in content.js that loads the iframe:
function showMenu(element) {
var iframe = document.createElement('iframe');
iframe.src = chrome.runtime.getURL('menu.html);
iframe.style.cssText = "\
position:absolute;\
visibility:visible;\
top:33%;\
right:0px;\
width:47px;\
height:198px;\
margin:0;\
padding:0;\
border:none;\
overflow:hidden;\
background:transparent;\
z-index:999999;\
";
element.append(iframe);
}
menu.html
<style>
html, body, iframe, h2 {
margin: 0;
padding: 0;
border:none;
display: block;
width: 100vw;
height: 100vh;
background: transparent;
color: black;
}
h2 {
height: 50px;
font-size: 20px;
}
iframe {
height: calc(100vh - 50px);
}
</style>
<iframe class="menu"></iframe>