1

読書アプリであるhtml5/JSでWindows8ストアアプリを開発しています。コンテンツ ページは次のようになります。 ここに画像の説明を入力

また、CSS-Grid-Layout を使用してページ レイアウトを次のように管理しています。

<body>
    <div class="contentPagepage fragment">
        <header aria-label="Header content" role="banner">
            <button class="win-backbutton black-button" aria-label="Back" disabled type="button"></button>
            <h1 class="titlearea win-type-ellipsis">
                <span class="pagetitle"></span>
            </h1>
            <h2>
                <span class=""></span>
            </h2>
        </header>
        <div class="content clearfix" aria-label="Main content">
            <div id="leftContainer">
                <p>Left container</p>
            </div>

            <section id="rightContainer">
                <div id="navContainer">
                    <button type="button">button 1</button>
                    <button type="button">button 2</button>
                    <button type="button">button 3</button>
                </div>
                <!--<article>-->
                    <div id="contentContainer" class="item-content" aria-label="Main content">
                    html content 
                    </div>
            </section>

        </div>

    </div>
</body>

css ファイルは次のとおりです。

.contentPagepage, .black-button {
    background-color: #EEEEEE;
    color: black;
}

.clear{ clear: both; }
.clearfix:after{ 
content:"."; display:block; height:0; clear:both; 
visibility:hidden; 
font-size: 0;
}

*html .clearfix{ 
 height:1%; 
}

*+html .clearfix{ 
 height:1%; 
}

.contentPagepage .content {
    -ms-grid-row-span: 2;
    display: -ms-grid;
    -ms-grid-columns: 40% 60%;
    height: calc(100% - 183px);
    margin: 133px 120px 0 120px;
    border: 1px solid #000;
}

#leftContainer {
    height: calc(100% - 183px);
    -ms-grid-column: 1;
    background-color: greenyellow;
    margin: 0 10px 10px 0;
}

#rightContainer{
    -ms-grid-column: 2;
    display: -ms-grid;
    -ms-grid-rows: 30px auto;
}

#navContainer {
    -ms-grid-row: 1;
}

#contentContainer {
    -ms-grid-row: 2;
    overflow-y: auto;
    height: calc(100% - 0px);
}

.contentPagepage .content #contentContainer {
    -ms-grid-row: 2;
    height: auto;
    background-color: red;
    display: block;
    overflow-y: auto;
}

これで、レイアウト システムは正常に動作しますが、コンテンツ エリアも修正されました。つまり、「lement.querySelector(".content .item-content").innerHTML = item.content;」を使用すると HTMLコンテンツをロードするために、コンテンツの高さがコンテナよりも大きくてもスクロールバーはありません。

では、どうすればこの問題を解決できますか?

4

1 に答える 1

1

まず.contentPagepage .content #contentContainer、CSSから""ブロックを削除します。#rightContainer次に、とを次のように置き換え#contentContainerます。

#rightContainer{
    -ms-grid-column: 2;
    -ms-grid-rows: 30px 1fr;
    display: -ms-grid;
    height: calc(100% - 183px);
}

#contentContainer {
    -ms-grid-row: 2;
    overflow-y: scroll;
    background-color: red;
    height: 100%;
}
于 2013-01-04T11:59:25.163 に答える