【发布时间】:2018-03-04 23:22:45
【问题描述】:
以下显示了我的应用程序的布局: http://jsfiddle.net/rhgyLjvx/
它有应用程序主标题(红色)、粘性部分标题(深蓝色)、固定页脚(灰色)和固定左侧导航(绿色)。应用程序的两侧应该有完整的滚动条。并且应该只滚动主要部分(黄色)。
垂直滚动如我所愿。但粘性部分标题(深蓝色)随部分水平滚动。
有什么方法可以让粘性标题固定在左右两侧并停止横向滚动?
我遇到了另一个大问题。我的整个应用程序在设备中滚动,包括固定位置的 div。请检查移动模拟器。
Array.from(document.querySelectorAll('.Sticky')).forEach((stickyEl) => {
console.log("&&&&&&&&&&&&&&&&&&& ", stickyEl)
Stickyfill.add(stickyEl);
});
#root, body, html {
height: 100%;
width: 100%;
}
.app {
height: 100%;
width: 100%;
}
.main {
padding-top: 70px;
height: 100%;
box-sizing: border-box;
}
.header {
width: 100%;
float: left;
min-height: 70px;
max-height: 70px;
background-color:red;
padding: 20px;
box-sizing: border-box;
position: fixed;
z-index: 999;
}
.sidenav {
background-color:green;
width: 250px;
float: left;
overflow-y: auto;
position: fixed;
height: 100%;
z-index: 999;
}
.landing {
height: 100%;
background-color: black;
position: absolute;
left: 250px;
}
.content {
padding: 5px;
height: 100%;
background-color: grey;
}
.view {
width: 100%;
background-color: aqua;
}
.page-header {
background-color: #0c004a;
height: 50px;
z-index: 999;
position: sticky;
top: 70px;
right: 0;
left: 250px;
margin-left: 5px;
margin-right: 5px;
}
.page-section {
flex: 0 1 auto;
margin-bottom: 50px;
background-color: purple;
}
.page-content {
width: 100%;
background-color: pink;
}
.page-panel {
display: block;
background-color: yellow;
margin-bottom: .5rem;
width: 75rem;
min-height: 43.8rem;
}
.page-footer {
height: 50px;
background-color: #979797;
opacity: 1;
display: flex;
flex-direction: row;
justify-content: flex-end;
align-items: center;
position: fixed;
bottom: 0;
right: 0;
left: 250px;
}
<div id="root">
<div class="app">
<header id="app-header" class="header"></header>
<div class="main">
<nav id="side-nav" class="sidenav"></nav>
<div class="landing">
<div class="content">
<div id="adeb-maint" class="view">
<div class="Sticky page-header"></div>
<div class="page-section">
<div class="page-content">
<div class="page-panel" style="width: 75rem; min-height: 43.8rem;">
<label>Customer WWDSSD:</label>
<label style="margin-top: 750px;display: block;">Last Change skdjskdq :</label>
</div>
</div>
</div>
<div class="page-footer">
<div class="actions-bar">
<button name="OK" class="ok">OK</button>
<button name="Cancel" class="cancel">Cancel</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/stickyfill/2.0.3/stickyfill.min.js"></script>
【问题讨论】:
-
给我一点时间来研究一下你的 HTML,因为乍一看它很乱
标签: javascript html css