- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试使用一个名为 scrollToFixed 的插件修复滚动条上的标题,就像 iOS 联系人列表一样。不过,我看不出如何使 header (.learning-objective-header) 固定并相对于容器。
<div class="panel-container">
<div class="title">Assessment - Year 1 - Summer Half Term</div>
<div class="content">
<div class="nav-bar">
<select><option>English 80%</option></select>
<button class="submit-btn">Send Assessment</button>
</div>
<div class="column-container">
<div class="review-screen-wrapper">
<div class="review-screen perfect-scroll">
<div class="learning-objective-header">
<table>
<thead>
<tr>
<th class="col-1 learning-objective-label">Writing</th>
<th class="col-2 marking-scheme-positive">I can</th>
<th class="col-3 marking-scheme-neutral">Nearly there</th>
<th class="col-4 marking-scheme-negative">I need help</th>
</tr>
</thead>
</table>
</div>
<div class="learning-objective-body">
<table>
<tbody>
<tr>
<td class="col-1 sub-learning-objective-label">Can I use a captial letter?</td>
<td class="col-2 marking-scheme-positive"><span class="marking-scheme-input"></span></td>
<td class="col-3 marking-scheme-neutral"><span class="marking-scheme-input"></span></td>
<td class="col-4 marking-scheme-negative"><span class="marking-scheme-input"></span></td>
</tr>
<tr>
<td class="col-1 sub-learning-objective-label">Can I use a captial letter?</td>
<td class="col-2 marking-scheme-positive"><span class="marking-scheme-input"></span></td>
<td class="col-3 marking-scheme-neutral"><span class="marking-scheme-input"></span></td>
<td class="col-4 marking-scheme-negative"><span class="marking-scheme-input"></span></td>
</tr>
<tr>
<td class="col-1 sub-learning-objective-label">Can I use a captial letter?</td>
<td class="col-2 marking-scheme-positive"><span class="marking-scheme-input"></span></td>
<td class="col-3 marking-scheme-neutral"><span class="marking-scheme-input"></span></td>
<td class="col-4 marking-scheme-negative"><span class="marking-scheme-input"></span></td>
</tr>
<tr>
<td class="col-1 sub-learning-objective-label">Can I use a captial letter?</td>
<td class="col-2 marking-scheme-positive"><span class="marking-scheme-input"></span></td>
<td class="col-3 marking-scheme-neutral"><span class="marking-scheme-input"></span></td>
<td class="col-4 marking-scheme-negative"><span class="marking-scheme-input"></span></td>
</tr>
<tr>
<td class="col-1 sub-learning-objective-label">Can I use a captial letter?</td>
<td class="col-2 marking-scheme-positive"><span class="marking-scheme-input"></span></td>
<td class="col-3 marking-scheme-neutral"><span class="marking-scheme-input"></span></td>
<td class="col-4 marking-scheme-negative"><span class="marking-scheme-input"></span></td>
</tr>
<tr>
<td class="col-1 sub-learning-objective-label">Can I use a captial letter?</td>
<td class="col-2 marking-scheme-positive"><span class="marking-scheme-input"></span></td>
<td class="col-3 marking-scheme-neutral"><span class="marking-scheme-input"></span></td>
<td class="col-4 marking-scheme-negative"><span class="marking-scheme-input"></span></td>
</tr>
<tr>
<td class="col-1 sub-learning-objective-label">Can I use a captial letter?</td>
<td class="col-2 marking-scheme-positive"><span class="marking-scheme-input"></span></td>
<td class="col-3 marking-scheme-neutral"><span class="marking-scheme-input"></span></td>
<td class="col-4 marking-scheme-negative"><span class="marking-scheme-input"></span></td>
</tr>
<tr>
<td class="col-1 sub-learning-objective-label">Can I use a captial letter?</td>
<td class="col-2 marking-scheme-positive"><span class="marking-scheme-input"></span></td>
<td class="col-3 marking-scheme-neutral"><span class="marking-scheme-input"></span></td>
<td class="col-4 marking-scheme-negative"><span class="marking-scheme-input"></span></td>
</tr>
<tr>
<td class="col-1 sub-learning-objective-label">Can I use a captial letter?</td>
<td class="col-2 marking-scheme-positive"><span class="marking-scheme-input"></span></td>
<td class="col-3 marking-scheme-neutral"><span class="marking-scheme-input"></span></td>
<td class="col-4 marking-scheme-negative"><span class="marking-scheme-input"></span></td>
</tr>
<tr>
<td class="col-1 sub-learning-objective-label">Can I use a captial letter?</td>
<td class="col-2 marking-scheme-positive"><span class="marking-scheme-input"></span></td>
<td class="col-3 marking-scheme-neutral"><span class="marking-scheme-input"></span></td>
<td class="col-4 marking-scheme-negative"><span class="marking-scheme-input"></span></td>
</tr>
<tr>
<td class="col-1 sub-learning-objective-label">Can I use a captial letter?</td>
<td class="col-2 marking-scheme-positive"><span class="marking-scheme-input"></span></td>
<td class="col-3 marking-scheme-neutral"><span class="marking-scheme-input"></span></td>
<td class="col-4 marking-scheme-negative"><span class="marking-scheme-input"></span></td>
</tr>
<tr>
<td class="col-1 sub-learning-objective-label">Can I use a captial letter?</td>
<td class="col-2 marking-scheme-positive"><span class="marking-scheme-input"></span></td>
<td class="col-3 marking-scheme-neutral"><span class="marking-scheme-input"></span></td>
<td class="col-4 marking-scheme-negative"><span class="marking-scheme-input"></span></td>
</tr>
<tr>
<td class="col-1 sub-learning-objective-label">Can I use a captial letter?</td>
<td class="col-2 marking-scheme-positive"><span class="marking-scheme-input"></span></td>
<td class="col-3 marking-scheme-neutral"><span class="marking-scheme-input"></span></td>
<td class="col-4 marking-scheme-negative"><span class="marking-scheme-input"></span></td>
</tr>
<tr>
<td class="col-1 sub-learning-objective-label">Can I use a captial letter?</td>
<td class="col-2 marking-scheme-positive"><span class="marking-scheme-input"></span></td>
<td class="col-3 marking-scheme-neutral"><span class="marking-scheme-input"></span></td>
<td class="col-4 marking-scheme-negative"><span class="marking-scheme-input"></span></td>
</tr>
<tr>
<td class="col-1 sub-learning-objective-label">Can I use a captial letter?</td>
<td class="col-2 marking-scheme-positive"><span class="marking-scheme-input"></span></td>
<td class="col-3 marking-scheme-neutral"><span class="marking-scheme-input"></span></td>
<td class="col-4 marking-scheme-negative"><span class="marking-scheme-input"></span></td>
</tr>
<tr>
<td class="col-1 sub-learning-objective-label">Can I use a captial letter?</td>
<td class="col-2 marking-scheme-positive"><span class="marking-scheme-input"></span></td>
<td class="col-3 marking-scheme-neutral"><span class="marking-scheme-input"></span></td>
<td class="col-4 marking-scheme-negative"><span class="marking-scheme-input"></span></td>
</tr>
<tr>
<td class="col-1 sub-learning-objective-label">Can I use a captial letter?</td>
<td class="col-2 marking-scheme-positive"><span class="marking-scheme-input"></span></td>
<td class="col-3 marking-scheme-neutral"><span class="marking-scheme-input"></span></td>
<td class="col-4 marking-scheme-negative"><span class="marking-scheme-input"></span></td>
</tr>
<tr>
<td class="col-1 sub-learning-objective-label">Can I use a captial letter?</td>
<td class="col-2 marking-scheme-positive"><span class="marking-scheme-input"></span></td>
<td class="col-3 marking-scheme-neutral"><span class="marking-scheme-input"></span></td>
<td class="col-4 marking-scheme-negative"><span class="marking-scheme-input"></span></td>
</tr>
</tbody>
</table>
</div>
<div class="learning-objective-header">
<table>
<thead>
<tr>
<th class="col-1 learning-objective-label">Writing</th>
<th class="col-2 marking-scheme-positive">I can</th>
<th class="col-3 marking-scheme-neutral">Nearly there</th>
<th class="col-4 marking-scheme-negative">I need help</th>
</tr>
</thead>
</table>
</div>
<div class="learning-objective-body">
<table>
<tbody>
<tr>
<td class="col-1 sub-learning-objective-label">Can I use a captial letter?</td>
<td class="col-2 marking-scheme-positive"><span class="marking-scheme-input"></span></td>
<td class="col-3 marking-scheme-neutral"><span class="marking-scheme-input"></span></td>
<td class="col-4 marking-scheme-negative"><span class="marking-scheme-input"></span></td>
</tr>
<tr>
<td class="col-1 sub-learning-objective-label">Can I use a captial letter?</td>
<td class="col-2 marking-scheme-positive"><span class="marking-scheme-input"></span></td>
<td class="col-3 marking-scheme-neutral"><span class="marking-scheme-input"></span></td>
<td class="col-4 marking-scheme-negative"><span class="marking-scheme-input"></span></td>
</tr>
<tr>
<td class="col-1 sub-learning-objective-label">Can I use a captial letter?</td>
<td class="col-2 marking-scheme-positive"><span class="marking-scheme-input"></span></td>
<td class="col-3 marking-scheme-neutral"><span class="marking-scheme-input"></span></td>
<td class="col-4 marking-scheme-negative"><span class="marking-scheme-input"></span></td>
</tr>
<tr>
<td class="col-1 sub-learning-objective-label">Can I use a captial letter?</td>
<td class="col-2 marking-scheme-positive"><span class="marking-scheme-input"></span></td>
<td class="col-3 marking-scheme-neutral"><span class="marking-scheme-input"></span></td>
<td class="col-4 marking-scheme-negative"><span class="marking-scheme-input"></span></td>
</tr>
<tr>
<td class="col-1 sub-learning-objective-label">Can I use a captial letter?</td>
<td class="col-2 marking-scheme-positive"><span class="marking-scheme-input"></span></td>
<td class="col-3 marking-scheme-neutral"><span class="marking-scheme-input"></span></td>
<td class="col-4 marking-scheme-negative"><span class="marking-scheme-input"></span></td>
</tr>
<tr>
<td class="col-1 sub-learning-objective-label">Can I use a captial letter?</td>
<td class="col-2 marking-scheme-positive"><span class="marking-scheme-input"></span></td>
<td class="col-3 marking-scheme-neutral"><span class="marking-scheme-input"></span></td>
<td class="col-4 marking-scheme-negative"><span class="marking-scheme-input"></span></td>
</tr>
<tr>
<td class="col-1 sub-learning-objective-label">Can I use a captial letter?</td>
<td class="col-2 marking-scheme-positive"><span class="marking-scheme-input"></span></td>
<td class="col-3 marking-scheme-neutral"><span class="marking-scheme-input"></span></td>
<td class="col-4 marking-scheme-negative"><span class="marking-scheme-input"></span></td>
</tr>
<tr>
<td class="col-1 sub-learning-objective-label">Can I use a captial letter?</td>
<td class="col-2 marking-scheme-positive"><span class="marking-scheme-input"></span></td>
<td class="col-3 marking-scheme-neutral"><span class="marking-scheme-input"></span></td>
<td class="col-4 marking-scheme-negative"><span class="marking-scheme-input"></span></td>
</tr>
<tr>
<td class="col-1 sub-learning-objective-label">Can I use a captial letter?</td>
<td class="col-2 marking-scheme-positive"><span class="marking-scheme-input"></span></td>
<td class="col-3 marking-scheme-neutral"><span class="marking-scheme-input"></span></td>
<td class="col-4 marking-scheme-negative"><span class="marking-scheme-input"></span></td>
</tr>
<tr>
<td class="col-1 sub-learning-objective-label">Can I use a captial letter?</td>
<td class="col-2 marking-scheme-positive"><span class="marking-scheme-input"></span></td>
<td class="col-3 marking-scheme-neutral"><span class="marking-scheme-input"></span></td>
<td class="col-4 marking-scheme-negative"><span class="marking-scheme-input"></span></td>
</tr>
<tr>
<td class="col-1 sub-learning-objective-label">Can I use a captial letter?</td>
<td class="col-2 marking-scheme-positive"><span class="marking-scheme-input"></span></td>
<td class="col-3 marking-scheme-neutral"><span class="marking-scheme-input"></span></td>
<td class="col-4 marking-scheme-negative"><span class="marking-scheme-input"></span></td>
</tr>
<tr>
<td class="col-1 sub-learning-objective-label">Can I use a captial letter?</td>
<td class="col-2 marking-scheme-positive"><span class="marking-scheme-input"></span></td>
<td class="col-3 marking-scheme-neutral"><span class="marking-scheme-input"></span></td>
<td class="col-4 marking-scheme-negative"><span class="marking-scheme-input"></span></td>
</tr>
<tr>
<td class="col-1 sub-learning-objective-label">Can I use a captial letter?</td>
<td class="col-2 marking-scheme-positive"><span class="marking-scheme-input"></span></td>
<td class="col-3 marking-scheme-neutral"><span class="marking-scheme-input"></span></td>
<td class="col-4 marking-scheme-negative"><span class="marking-scheme-input"></span></td>
</tr>
<tr>
<td class="col-1 sub-learning-objective-label">Can I use a captial letter?</td>
<td class="col-2 marking-scheme-positive"><span class="marking-scheme-input"></span></td>
<td class="col-3 marking-scheme-neutral"><span class="marking-scheme-input"></span></td>
<td class="col-4 marking-scheme-negative"><span class="marking-scheme-input"></span></td>
</tr>
<tr>
<td class="col-1 sub-learning-objective-label">Can I use a captial letter?</td>
<td class="col-2 marking-scheme-positive"><span class="marking-scheme-input"></span></td>
<td class="col-3 marking-scheme-neutral"><span class="marking-scheme-input"></span></td>
<td class="col-4 marking-scheme-negative"><span class="marking-scheme-input"></span></td>
</tr>
<tr>
<td class="col-1 sub-learning-objective-label">Can I use a captial letter?</td>
<td class="col-2 marking-scheme-positive"><span class="marking-scheme-input"></span></td>
<td class="col-3 marking-scheme-neutral"><span class="marking-scheme-input"></span></td>
<td class="col-4 marking-scheme-negative"><span class="marking-scheme-input"></span></td>
</tr>
<tr>
<td class="col-1 sub-learning-objective-label">Can I use a captial letter?</td>
<td class="col-2 marking-scheme-positive"><span class="marking-scheme-input"></span></td>
<td class="col-3 marking-scheme-neutral"><span class="marking-scheme-input"></span></td>
<td class="col-4 marking-scheme-negative"><span class="marking-scheme-input"></span></td>
</tr>
<tr>
<td class="col-1 sub-learning-objective-label">Can I use a captial letter?</td>
<td class="col-2 marking-scheme-positive"><span class="marking-scheme-input"></span></td>
<td class="col-3 marking-scheme-neutral"><span class="marking-scheme-input"></span></td>
<td class="col-4 marking-scheme-negative"><span class="marking-scheme-input"></span></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
@import "http://fonts.googleapis.com/css?family=Open+Sans:400,600,700";
.panel-container ,
.panel-container * {
box-sizing: border-box;
}
body {
background: #014783;
color: #fff;
font-family: "Open Sans";
}
.panel-container {
background: #006bb3;
border: 2px solid #b5e4fe;
border-radius: 8px;
margin: 20px;
position: relative;
height: calc(100vh - 40px);
}
.title {
font-size: 22px;
background: #0089da;
padding: 15px 22px;
border-radius: 6px 6px 0 0;
}
.nav-bar {
text-align: left;
}
.submit-btn {
float: right;
}
.content {
padding: 22px;
position: relative;
}
.column-container:after {
content: " ";
display: table;
clear: both;
}
.review-screen-wrapper {
position: relative;
margin-top: 22px;
border-radius: 5px;
color: #444;
}
table {
border-collapse: collapse;
border-spacing: 0;
table-layout: fixed;
width: 100%;
}
.review-screen {
}
.review-screen.perfect-scroll {
height: calc(100vh - 184px);
position: relative;
overflow-y: scroll;
border-radius: 5px;
}
.review-screen table th,
.review-screen table td {
padding: 15px;
vertical-align: middle;
text-align: left;
}
.review-screen table th {
font-size: 18px;
font-weight: 600;
padding: 13px 15px;
}
.learning-objective-header ~ .learning-objective-header table th.col-1 {
border-top: 1px solid #CBCBCB;
}
.review-screen table th.col-1 {
background: #F5F5F5;
border-bottom: 1px solid #CBCBCB;
}
.learning-objective-header ~ .learning-objective-header table .col-1 {
border-top: 1px solid #E2E2E2;
}
.review-screen table .col-1 {
border-bottom: 1px solid #E2E2E2;
}
.learning-objective-header ~ .learning-objective-header table .col-2 {
border-top: 1px solid #A7CB72;
}
.review-screen table th.col-2 {
border-bottom: 1px solid #A7CB72;
}
.review-screen table .col-2 {
border-bottom: 1px solid #BAE083;
}
.learning-objective-header ~ .learning-objective-header table .col-3 {
border-top: 1px solid #E5C46D;
}
.review-screen table th.col-3 {
border-bottom: 1px solid #E5C46D;
}
.review-screen table .col-3 {
border-bottom: 1px solid #EDD9A4;
}
.learning-objective-header ~ .learning-objective-header table .col-4 {
border-top: 1px solid #F9959D;
}
.review-screen table th.col-4 {
border-bottom: 1px solid #F9959D;
}
.review-screen table .col-4 {
border-bottom: 1px solid #F7AFB5;
}
.review-screen table .col-2,
.review-screen table .col-3,
.review-screen table .col-4 {
width: 160px;
text-align: center;
}
.review-screen table .col-1 {
background: #FFF;
}
.review-screen table .col-2 {
background: #ddecd5;
color: #81a34f;
}
.review-screen table .col-3 {
background: #fdeec7;
color: #be9424;
}
.review-screen table .col-4 {
background: #fecacc;
color: #d16972;
}
.review-screen .learning-objective-body tr:last-child .col-1,
.review-screen .learning-objective-body tr:last-child .col-2,
.review-screen .learning-objective-body tr:last-child .col-3,
.review-screen .learning-objective-body tr:last-child .col-4 {
border: 0 none;
}
.marking-scheme-input {
cursor: pointer;
border: 12px solid #FFF;
box-shadow: 0 0 0 1px rgba(1, 1, 1, 0.125);
border-radius: 24px;
display: block;
height: 12px;
width: 12px;
margin: auto;
position: relative;
}
.marking-scheme-input:after {
content: " ";
display: none;
border-radius: 10px;
position: absolute;
top: -9px;
left: -9px;
border: 9px solid currentColor;
}
.marking-scheme-input:not(.active):hover:after {
display: block;
opacity: 0.5;
}
.marking-scheme-input.active:after {
display: block;
}
.ps-container>.ps-scrollbar-y-rail>.ps-scrollbar-y {
background-color: #343434;
}
.ps-container:hover>.ps-scrollbar-y-rail:hover>.ps-scrollbar-y {
background-color: #343434;
}
.ps-container.ps-in-scrolling.ps-y>.ps-scrollbar-y-rail>.ps-scrollbar-y {
background-color: #343434;
}
$('.learning-objective-header').scrollToFixed();
最佳答案
我认为插件没有提供处理相对固定定位的方法。但是,它确实提供了根据屏幕顶部和底部的位置绝对定位固定元素的选项。因此,如果您知道固定元素上方区域的高度,则可以简单地使用 marginTop 选项来设置位置,如下所示:
$(document).ready(function() {
$('.learning-objective-header').scrollToFixed({
marginTop: 137
});
});
这是在修改后的 Codepen 中运行的:http://codepen.io/pen/rVpqpz
关于jquery - 固定在溢出容器内的位置 - scrollToFixed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31122322/
如果我使用函数中的 scrolltofixed 插件调用页脚的限制,我会遇到一个奇怪的问题。 由于页脚和动态内容存在其他问题,我已经在限制下进行了此解决方法。 这里是 original fiddle
该问题在每个浏览器中的表现都不同,例如在 Firefox 中大约一个空格如果您再次滚动到顶部,则会出现具有相同高度的滚动框。在 chrome 中,滚动时框会变得狭窄等等...... 使用的调用是:
我对 scrollToFixed 脚本有疑问。 https://github.com/bigspotteddog/ScrollToFixed这是一个案例:http://dash.com.pl/CTP/
我正在尝试使用一个名为 scrollToFixed 的插件修复滚动条上的标题,就像 iOS 联系人列表一样。不过,我看不出如何使 header (.learning-objective-header)
我正在尝试使用 ScrollToFixed 进行简单的固定滚动, 但我遇到了一些奇怪的行为 我准备了一个jsfiddle显示出以下问题: html: left
jquery scrollToFixed 在到达页面最顶部时停止,它只是出现在本应固定在最顶部的 div 的顶部。 Here is what I have so far . var arr = new
遇到涉及开发中站点的问题。其中一个页面集成了一个 wordpress 博客。我已经 scrolltofixed 运行,但问题是在博客页面上,菜单的高度比我的其他页面(没有 wordpress)高。 (
我正在尝试让滚动跟随 ScrollToFixed.js 这是我的观点: Summary 1
无论我做什么,我似乎都无法让 scrolltofixed 代码在我的 tumblr 页面上工作。我看过here和 here ,但似乎没有任何效果。我的 tumblr 页面是 http://htmlte
我在使用 scrolltofixed jquery 插件时遇到问题 https://github.com/bigspotteddog/ScrollToFixed 我使用: $('#tostick').
我使用 ScrollToFixed 非常成功,但有一个问题。我的内容中有一个正在扩展的 div,如果展开该 div,scrollToFixed 端点不会动态增加以适应新的高度。 因此,端点仍然固定在扩
我正在使用 scrollToFixed用于固定 div 位置的插件。这是我正在使用的 html 代码 和CSS *{
我们正在使用 jQuery Mobile、Bootstrap 3、scrollToFixed。我们已经建立了一个几乎可以满足我们需要的工作页面,但是,我们无法让选项卡内容向上滚动。 我们在此处包含了
我是一名优秀的程序员,十分优秀!