【发布时间】:2012-08-01 08:58:53
【问题描述】:
有没有一种标准的方法可以使用 WinJS / javascript 在 Metro 应用程序中实现水平滚动效果?
假设我有多个 div 动态添加,宽度/高度可变,我希望屏幕在溢出时内容更宽时水平滚动,我将如何实现呢?
我不希望在滚动包装上使用具有固定宽度的overflow-x:scroll
<section class="header">
Header which is always shown in top left corner
</section>
<section class="magic-winjs-scroll-container-class">
<div style="width:300px;height:200px">Some random div which should stack horizontally</div>
<div style="width:300px;height:200px">Some random div which should stack horizontally</div>
<div style="width:300px;height:200px">Some random div which should stack horizontally</div>
<div style="width:300px;height:200px">Some random div which should stack horizontally</div>
<div style="width:300px;height:200px">Some random div which should stack horizontally</div>
<div style="width:300px;height:200px">Some random div which should stack horizontally</div>
</section>
解决方案:
CSS
.magic-winjs-scroll-container-class {
display: -ms-flexbox;
-ms-flex-direction: row;
-ms-flex-align: center;
}
【问题讨论】:
标签: javascript html css microsoft-metro winjs