【问题标题】:How to add vertical scrolling to Windows 8 app in snapped view如何在快照视图中向 Windows 8 应用程序添加垂直滚动
【发布时间】:2013-03-28 09:22:17
【问题描述】:

我正在开发一个使用 Html、CSS 和 JavaScript 编写的 Windows 8 应用程序。在快照视图中,某些屏幕将无法看到全部内容,这就是我想要垂直滚动的原因。

我该如何解决这个问题?我想要它在 html 或 CSS 中。

HTML:

<section aria-label="Main content" role="main">
        <div class="divContainer" style="width: auto; height: auto; overflow:auto; display: -ms-grid; 
            -ms-grid-columns: 450px 50px 450px 46px 250px; 
            -ms-grid-rows: auto">
            <div id="pageCalc">
                <h2>User information</h2>
                ... 
                Some text here
                ...
            </div>
            <div id="pageText">
                <h2>Contact information</h2>
                ...
                Some text here
                ...
                <img id="imageDiv" src="/images/aboutlogo.png" border="0" alt="">


            </div>
            <div id="pageAdd">
                ...
                An add here
                ...
            </div>
        </div>
    </section>

#pageText、#pageAdd 和 #pageCalc 的 Width、height 和类似的东西在 css 中定义,然后在快照视图中,它使用这段代码:

CSS:

@media screen and (-ms-view-state: snapped) {
.about section[role=main] {
    margin-left: 20px;
    margin-right: 20px;
}

.divContainer {
    height:1080px;
    width: 230px;
    display:-ms-grid;
    -ms-grid-column: 230px;
    -ms-grid-row: auto 20px auto 20px auto;
    overflow: auto;

}

#pageCalc, #pageText, #pageAdd {
    width: 230px;
}

#pageCalc {
    -ms-grid-column: 1;
    -ms-grid-row: 1;
}

#pageText {
    -ms-grid-column: 1;
    -ms-grid-row: 3;
}

#pageAdd {
    -ms-grid-column: 1;
    -ms-grid-row: 5;
}

}

【问题讨论】:

    标签: javascript html css microsoft-metro vertical-scrolling


    【解决方案1】:

    html、css 和 JavaScript 格式的 Win8 应用程序在 Microsoft WWA Host 进程上运行。那是基于 Internet Explorer 的渲染平台。因此,您可以像在 IE 上一样创建应用程序。只需将您捕捉的内容包装到具有固定高度和overflow: autodiv 中,您将获得垂直滚动。

    【讨论】:

    • 在您的divContainer 上,您有内联声明:width: auto; height: auto;,因此它们具有优先权。在没有他们的情况下尝试一下。
    猜你喜欢
    • 2014-02-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-03-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多