六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 166|回复: 0

sharepoint母版页固定宽度与纵向滚动条靠右边(修改版)

[复制链接]

升级  48.67%

35

主题

35

主题

35

主题

秀才

Rank: 2

积分
123
 楼主| 发表于 2012-12-29 11:20:27 | 显示全部楼层 |阅读模式
<div id="cnblogs_post_body">之前文章对母版页固定宽度,但在添加list item时页面布局出现问题,后来找到方法修改这个bug,修改之后如下:

页面固定宽度为 990px, 整体居中,将纵向滚动条,移到浏览器的最右边
加css与js:
<div class="cnblogs_code"><style type="text/css">
#s4-bodyContainer
{
width
: 990px !important;
margin-left
:auto;
margin-right
:auto;
}

/* Aligns the Top Bars */
.ms-cui-ribbonTopBars
{
width
: 990px !important;
margin-left
:auto;
margin-right
:auto;
}

/* Turns off the border on the bottom of the tabs */
.ms-cui-ribbonTopBars > div
{
border-bottom
:1px solid transparent !important;
}
</style>

//当列表项多,超出指定宽度时后,背景为空白,所以根据列表项长度,将页面内容范围根据内容扩大,
<script type='text/javascript'>

$(document).ready(
function(){
//Elements with the potential to be too wide.
  elements = $(".ms-bodyareacell > div > *, .main-container > div > *");
  leftPanelWidth
= $("#s4-leftpanel").width();

  //For each Elements
  $(elements).each(function(){
    //if it's wider than the side width
    if($(this).width() > ($("#s4-bodyContainer").width() - leftPanelWidth ))
    {
      //Calculate the new width taking the left nav into account
      newWidth = leftPanelWidth + $(this).width();
      //Set the width!
      $("#s4-bodyContainer").attr("style","width:"+newWidth +"px!important")
    }
  });
});
</script>
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表