JavaScript How to just scroll the iframe but not its parent?

Current my page has a menu bar and iframe section to load the items in the menu bar when clicked. I wanted the iframe to scroll but not the parent page (i want the menu bar fixed to the top).

But the parent page scroll as well. So I set position: fixed for the parent page, the Content below can only be scrolled to a point and will eventually be cut off (see image below). How do I resolve this issue?

enter image description here

Answer:1

Here is a way using display: table, flex would be another way.

html,
body { height: 100%; margin: 0 }

.container {
  display: table;
  width: 100%;
  height: 100%;
}
.page-row {
  display: table-row;
  height: 0;
}
.page-row-expanded {
    height: 100%;
}

main iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: none;
}

.header {
  background-color: #bbb;
  padding: 10px;
}
<div class="container">
    <header class="page-row">
      <div class="header">
        Navigation bar
      </div>
    </header>
            
    <main class="page-row page-row-expanded">
        <iframe src="http://www.w3schools.com/"></iframe>
    </main>
    
</div>
Answer:2

I have written following code. $("input,textarea").blur(function () { debugger; var val = $.trim($(this).val()); if (val != "") { if (containsHTMLTags(val) == true)...

I have written following code. $("input,textarea").blur(function () { debugger; var val = $.trim($(this).val()); if (val != "") { if (containsHTMLTags(val) == true)...

I tried to add checked property to a specific checkbox using jquery, but it seems doesn't work properly. Checkbox Function Display function product_category_loop_array ($product_category_array = ...

I tried to add checked property to a specific checkbox using jquery, but it seems doesn't work properly. Checkbox Function Display function product_category_loop_array ($product_category_array = ...

EDIT: This is for an Electron project, with a local server spun up on the user's system. So, any concerns about what happens if multiple users attempt simultaneous access can be ignored! My client ...

EDIT: This is for an Electron project, with a local server spun up on the user's system. So, any concerns about what happens if multiple users attempt simultaneous access can be ignored! My client ...

  1. javascript resolve promises sequentially
  2. functional javascript resolving promises sequentially
  3. resolve promises sequential

I´m using mongoose and I need to find a model name from a model instance. In one part of the code I have: const schema = new mongoose.Schema({ name: { type: String, ...

I´m using mongoose and I need to find a model name from a model instance. In one part of the code I have: const schema = new mongoose.Schema({ name: { type: String, ...

  1. there she goes model name
  2. there she goes song model name