sharepoint 2010 页面刷新时滚动条位置保持不变 Controlling scrollbar position on postback
2013-02-07 09:07
507 查看
在sharepoint 2010中,如果当前页面的篇幅比较长,如何在拉动页面滚动条时,在刷新的条件下,保持滚动条位置,研究了一下,发现sharepoint 2010的母板页,和普通的asp.net页面有不太一样的地方,是通过一个属性document.getElementById("s4-workspace").scrollTop来控制的,以下是实现的脚本,只需要修改一下v4.master母版页,在里面添加一个javascript的方法。
html {overflow: auto;}/*better than on the body
body {
xoverflow:hidden;/*Needed to eliminate scrollbars*/
background:#000;
font: normal 80%/1.4 verdana, arial, sans-serif;
}
</style>
<script>
window.onload =function()
{
document.getElementById("s4-workspace").scrollTop=1;
document.body.scroll='yes';
document.getElementById("s4-workspace").style.overflow='auto';
}
</script>
在IE7,IE8,IE9,Google Chrome谷歌浏览器中,测试通过。
html {overflow: auto;}/*better than on the body
body {
xoverflow:hidden;/*Needed to eliminate scrollbars*/
background:#000;
font: normal 80%/1.4 verdana, arial, sans-serif;
}
</style>
<script>
window.onload =function()
{
document.getElementById("s4-workspace").scrollTop=1;
document.body.scroll='yes';
document.getElementById("s4-workspace").style.overflow='auto';
}
</script>
在IE7,IE8,IE9,Google Chrome谷歌浏览器中,测试通过。
相关文章推荐
- sharepoint 2010 页面刷新时滚动条位置保持不变 Controlling scrollbar position on postback
- sharepoint 2010 页面刷新时滚动条位置保持不变 Controlling scrollbar position on postback
- SharePoint【学习笔记】-- SharePoint 2010 页面刷新时滚动条位置保持不变 Controlling scrollbar position on postback
- sharepoint 2010 页面刷新时滚动条位置保持不变 Controlling scrollbar position on postback
- sharepoint 2010 页面刷新时滚动条位置保持不变 Controlling scrollbar position on postback
- PagesSection..::.MaintainScrollPositionOnPostBack(保持页滚动位置)
- ASP.NET页面刷新后滚动条保留在刷新前的位置 MaintainScrollPositionOnPostback
- 刷新页面时原来位置固定不动,在页面刷新的时候。MaintainScrollPositionOnPostback="true"
- 刷新页面时原来位置固定不动,在页面刷新的时候。MaintainScrollPositionOnPostback="true"
- ASP.NET页面刷新后滚动条保留在刷新前的位置 MaintainScrollPositionOnPostback
- ASP.NET中,页面刷新后跳转到刷新前的位置 MaintainScrollPositionOnPostback属性的使用
- 解析 Page.MaintainScrollPositionOnPostBack 属性 页面刷新后定位
- 页面回发(PostBack)后,滚动条位置保持不变
- 如何做到在页面POSTBACK刷新后,使LISTBOX的滚动条仍然保持上次的位置
- jsp页面刷新时,保持滚动条位置不变
- .net 刷新后滚动条不动加MaintainScrollPositionOnPostback=true 兼容gogle问题
- SharePoint 2013/2010 在一个列表或文档库内移动列表项,文档和文件夹位置而保持last modify by 等系统字段保持不变
- 页面刷新后滚动条保持原来位置,AutoPostBack=true后,保持页面焦点位置
- 在长aspx页面刷新后保持位置不变
- 页面刷新后保持滚动条的位置不变