博客园优化
Posted venicid
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了博客园优化相关的知识,希望对你有一定的参考价值。
页面定制CSS代码
div#blogTitle .subtitle{
color:#055;
font-size:16.5px;
font-weight:500;
text-indent:28px;
text-align: center;
}
div#sideBarMain{
padding:0px 10px 30px 20px;
}
#cnblogs_post_body h2 {
background: #00688B;
border-radius: 6px 6px 6px 6px;
box-shadow: 0 0 0 1px #5F5A4B, 1px 1px 6px 1px rgba(10, 10, 0, 0.5);
color: white;
font-family: Futura;
font-size: 18px;
font-weight: bold;
height: 20px;
line-height: 20px;
margin: 12px 0 !important;
padding: 8px 0 8px 10px;
text-shadow: 2px 2px 3px #222222;
margin-bottom: 20px;
width:70%;
text-align:center;
}
#cnblogs_post_body h3 {
background: #009ACD;
color: #FFFFFF;
border-radius: 6px 6px 6px 6px;
font-family: Futura;
font-size: 15px;
font-weight: bold;
height: 24px;
line-height: 24px;
margin: 12px 0 !important;
padding: 2px 0 2px 10px;
text-shadow: 2px 2px 3px #222222;
width:50%;
margin-bottom: 20px;
}
#gotop{
height: 50px;
width: 50px;
background-color: darkgray;
text-align: center;
font-size:18px;
position: fixed;
bottom: 30px;
right: 30px;
color: #fff;
cursor: pointer;
border-radius: 5px;
}
#gotop a{
color: #fff;
}
#gotop:hover{
background-color: #369;
}
#nav_next_page{
display:none
}
#mainContent{
margin-left:30px
}
/* 侧边栏 */
#sideBar{
display:none
}
博客侧边栏公告(支持html代码)(支持JS代码)
<!-- 用户头像 -->
<img src="//pic.cnblogs.com/avatar/1196120/20171201163409.png" style="border-radius:50%"/>
页首Html代码
<!-- 返回顶部 -->
<a href="#" id="gotop">返回顶部</a>
页脚Html代码
<script language="javascript" type="text/javascript">
function GenerateContentList()
{
var mainContent = $('#cnblogs_post_body');
var h2_list = $('#cnblogs_post_body h2'); //如果你的章节标题不是h2,只需要将这里的h2换掉即可
if(mainContent.length < 1)
return;
if(h2_list.length>0)
{
var content = '<a name="_labelTop"></a>';
content += '<div id="navCategory">';
content += '<p style="font-size:18px"><h1>阅读目录</h1></p>';
content += '<ul>';
for(var i=0; i<h2_list.length; i++)
{
var go_to_top = '<div style="text-align: right;"><a href="#_labelTop"></a><a name="_label' + i + '"></a></div>';
$(h2_list[i]).before(go_to_top);
var h3_list = $(h2_list[i]).nextAll("h2");
var li3_content = '';
for(var j=0; j<h3_list.length; j++)
{
var tmp = $(h3_list[j]).prevAll('h1').first();
if(!tmp.is(h2_list[i]))
break;
var li3_anchor = '<a name="_label' + i + '_' + j + '"></a>';
$(h3_list[j]).before(li3_anchor);
li3_content += '<li><a href="#_label' + i + '_' + j + '">' + $(h3_list[j]).text() + '</a></li>';
}
var li2_content = '';
if(li3_content.length > 0)
li2_content = '<li><a href="#_label' + i + '">' + $(h2_list[i]).text() + '</a><ul>' + li3_content + '</ul></li>';
else
li2_content = '<li><a href="#_label' + i + '">' + $(h2_list[i]).text() + '</a></li>';
content += li2_content;
}
content += '</ul>';
content += '</div><p> </p>';
//content += '<p style="font-size:18px"><b>正文</b></p>';
}
if($('#cnblogs_post_body').length != 0 )
{
$($('#cnblogs_post_body')[0]).prepend(content);
}
}
GenerateContentList();
</script>
以上是关于博客园优化的主要内容,如果未能解决你的问题,请参考以下文章