【轮子狂魔】手把手教你用JS给博客动态增加目录 - 超级懒人版

动态显示目录的作用

不用每次写博客的时候繁琐的人工整理目录,又可以动态浮动在右下角,方便快速跳到感兴趣的位置同时也可以快速的对文章内容有一个大概的了解。

实现原理

首先根据个人喜好,我习惯了用 h1 来做分类。所以本篇内容也主要是针对h1来提取目录。

如何提取出来h1呢?

先来看这张图,以猎豹浏览器为例:

首先在博客内容第一行点击鼠标右键,然后选择检查。这时会弹出右边的框,直接定位到我的h1标签,就这么简单的找到了它的父级 cnblogs_post_body 。

然后使用 jquery 选择器 来获取到这些h1,对jquery选择器不熟的直接跳这个链接温习一下:http://www.w3school.com.cn/jquery/jquery_ref_selectors.asp

$(‘#cnblogs_post_body h1‘)

就这么简单的一个括号就完成了对 h1 的提取。

在遍历所有的h1,取出内容之前,我们需要一个目录的容器。

$(‘#cnblogs_post_body‘).append(‘<div id="blog_catalog" class="blog_catalog"><ul><li><a id="blog_catalog_close" class="blog_catalog_close">>折叠目录</a></li></ul></div>‘);

这句简单解释就是在博客内容最末尾插入了一个 div,里面包含ul和一个默认的li 用于折叠目录。

接下来就要提取h1的内容了,但在这个过程中我们还要做一件事,就是自动给h1增加一个id,作为一个标准的懒人,我肯定连h1的id都不想写的,自动生成神马的最好了。

var id = 1;
$(‘#cnblogs_post_body h1‘).each(function(){
    $(this).attr(‘id‘,‘blog_catalog_id_‘+id);
    $(‘#blog_catalog ul‘).append(‘<li><a href="#blog_catalog_id_‘+id+‘">‘+$(this).text()+‘</a></li>‘);
    id++;
});

有了折叠,当然少不了展开。

$(‘#cnblogs_post_body‘).append(‘<div id="blog_catalog_open" class="blog_catalog_open">展开目录</div>‘);

最后一步,让展开目录和折叠目录联动起来

$(‘#blog_catalog_open‘).click(function(){
$(‘#blog_catalog‘).show();
$(‘#blog_catalog_open‘).hide();
});

$(‘#blog_catalog_close‘).click(function(){
$(‘#blog_catalog‘).hide();
$(‘#blog_catalog_open‘).show();
});

整个制作过程其实并不复杂,还有一些css样式应用上就完工了。

不管原理,我想直接用

怎么自定义皮肤我就不多说了,一抓一大把。下面直接给你们代码。

css:

.blog_catalog {
    display: none;
    width: auto;
    height: auto;
    float: right;
    position: fixed;
    right: 180px;
    bottom: 200px;
    z-index: 9999;
    background-color: #fff;
    font-size: 12px;
    margin: 10px 0 0 0;
    padding: 5px;
    text-align: center;
    border: 3px solid #55895b;
    border-radius: 5px;
    -webkit-box-shadow: 0px 1px 3px 0px rgba(0,0,0,.73), 0px 0px 18px 0px rgba(0,0,0,.13);
    -moz-box-shadow: 0px 1px 3px 0px rgba(0,0,0,.73), 0px 0px 18px 0px rgba(0,0,0,.13);
    box-shadow: 0px 1px 3px 0px rgba(0,0,0,.73), 0px 0px 18px 0px rgba(0,0,0,.13);
}

    .blog_catalog > li > a {
        background-color: #616975;
        background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(114, 122, 134)),to(rgb(80, 88, 100)));
        background-image: -webkit-linear-gradient(top, rgb(114, 122, 134), rgb(80, 88, 100));
        background-image: -moz-linear-gradient(top, rgb(114, 122, 134), rgb(80, 88, 100));
        background-image: -o-linear-gradient(top, rgb(114, 122, 134), rgb(80, 88, 100));
        background-image: -ms-linear-gradient(top, rgb(114, 122, 134), rgb(80, 88, 100));
        background-image: linear-gradient(top, rgb(114, 122, 134), rgb(80, 88, 100));
        filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,StartColorStr=‘#727a86‘, EndColorStr=‘#505864‘);
        -webkit-box-shadow: inset 0px 1px 0px 0px #878e98;
        -moz-box-shadow: inset 0px 1px 0px 0px #878e98;
        box-shadow: inset 0px 1px 0px 0px #878e98;
        width: 100%;
        height: 2.75em;
        line-height: 2.75em;
        text-indent: 2.75em;
        display: block;
        position: relative;
        font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
        font-weight: 600;
        color: #fff;
        text-shadow: 0px 1px 0px rgba(0,0,0,.5);
    }

    .blog_catalog ul li a {
        background: #fff;
        border-bottom: 1px solid #efeff0;
        width: 100%;
        height: 2.75em;
        line-height: 2.75em;
        display: block;
        position: relative;
        font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
        font-size: 0.923em;
        font-weight: 400;
        color: #878d95;
    }

        .blog_catalog ul li a:hover {
            cursor: pointer;
        }

    .blog_catalog > li > a:hover, .blog_catalog > li > a.active, .blog_catalog > li:target > a; /*add this*/ {
        background-color: #35afe3;
        background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(69, 199, 235)),to(rgb(38, 152, 219)));
        background-image: -webkit-linear-gradient(top, rgb(69, 199, 235), rgb(38, 152, 219));
        background-image: -moz-linear-gradient(top, rgb(69, 199, 235), rgb(38, 152, 219));
        background-image: -o-linear-gradient(top, rgb(69, 199, 235), rgb(38, 152, 219));
        background-image: -ms-linear-gradient(top, rgb(69, 199, 235), rgb(38, 152, 219));
        background-image: linear-gradient(top, rgb(69, 199, 235), rgb(38, 152, 219));
        filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,StartColorStr=‘#45c7eb‘, EndColorStr=‘#2698db‘);
        border-bottom: 1px solid #103c56;
        -webkit-box-shadow: inset 0px 1px 0px 0px #6ad2ef;
        -moz-box-shadow: inset 0px 1px 0px 0px #6ad2ef;
        box-shadow: inset 0px 1px 0px 0px #6ad2ef;
    }

    .blog_catalog > li > a.active {
        border-bottom: 1px solid #1a638f;
    }

    .blog_catalog > li > a:before {
        content: ‘‘;
        background-image: url(../images/sprite.png);
        background-repeat: no-repeat;
        font-size: 36px;
        height: 1em;
        width: 1em;
        position: absolute;
        left: 0;
        top: 50%;
        margin: -.5em 0 0 0;
    }

.item1 > a:before {
    background-position: 0 0;
}

.item2 > a:before {
    background-position: -38px 0;
}

.item3 > a:before {
    background-position: 0 -38px;
}

.item4 > a:before {
    background-position: -38px -38px;
}

.item5 > a:before {
    background-position: -76px 0;
}

.blog_catalog > li > a span {
    font-size: 0.857em;
    display: inline-block;
    position: absolute;
    right: 1em;
    top: 50%;
    background: #48515c;
    line-height: 1em;
    height: 1em;
    padding: .4em .6em;
    margin: -.8em 0 0 0;
    color: #fff;
    text-indent: 0;
    text-align: center;
    -webkit-border-radius: .769em;
    -moz-border-radius: .769em;
    border-radius: .769em;
    -webkit-box-shadow: inset 0px 1px 3px 0px rgba(0, 0, 0, .26), 0px 1px 0px 0px rgba(255, 255, 255, .15);
    -moz-box-shadow: inset 0px 1px 3px 0px rgba(0, 0, 0, .26), 0px 1px 0px 0px rgba(255, 255, 255, .15);
    box-shadow: inset 0px 1px 3px 0px rgba(0, 0, 0, .26), 0px 1px 0px 0px rgba(255, 255, 255, .15);
    text-shadow: 0px 1px 0px rgba(0,0,0,.5);
    font-weight: 500;
}

.blog_catalog > li > a:hover span,
.blog_catalog > li a.active span,
.blog_catalog > li:target > a span /*add this*/ {
    background: #2173a1;
}

.blog_catalog > li > ul li a:before {
    font-size: 8px;
    color: #bcbcbf;
    position: absolute;
    width: 1em;
    height: 1em;
    top: 0;
    left: -2.7em;
}

.blog_catalog > li > ul li:hover a,
.blog_catalog > li > ul li:hover a span,
.blog_catalog > li > ul li:hover a:before {
    color: #32373D;
}

.blog_catalog ul > li > a span {
    font-size: 0.857em;
    display: inline-block;
    position: absolute;
    right: 1em;
    top: 50%;
    / background: #fff;
    border: 1px solid #d0d0d3;
    line-height: 1em;
    height: 1em;
    padding: .4em .7em;
    margin: -.9em 0 0 0;
    color: #878d95;
    text-indent: 0;
    text-align: center;
    -webkit-border-radius: .769em;
    -moz-border-radius: 769em;
    border-radius: 769em;
    text-shadow: 0px 0px 0px rgba(255,255,255,.01));
}

/*additional*/

.blog_catalog > li > ul {
    height: 0;
    overflow: hidden;
    opacity: 0;
    filter: alpha(opacity=0); /* IE6-IE8 */
    -webkit-transition: opacity 0.9s ease-in-out;
    -moz-transition: opacity 0.9s ease-in-out;
    -o-transition: opacity 0.9s ease-in-out;
    -ms-transition: opacity 0.9s ease-in-out;
    transition: opacity 0.9s ease-in-out;
}

.blog_catalog > li:target > ul {
    height: auto; /*using auto nullifies the height transitions, but it makes things flexible which is more important*/
    border-bottom: 1px solid #51555a;
    opacity: 1;
    filter: alpha(opacity=100); /* IE6-IE8 */
}

#cnblogs_post_body ul li {
    list-style-type: none;
    margin-left: -30px;
}

.blog_catalog_open {
    width: auto;
    height: auto;
    float: right;
    position: fixed;
    right: 180px;
    bottom: 200px;
    z-index: 9999;
    background-color: #fff;
    font-size: 12px;
    width: 125px;
    margin: 10px 0 0 0;
    padding: 5px;
    text-align: center;
    border: 3px solid #55895b;
    border-radius: 5px;
    -webkit-box-shadow: 0px 1px 3px 0px rgba(0,0,0,.73), 0px 0px 18px 0px rgba(0,0,0,.13);
    -moz-box-shadow: 0px 1px 3px 0px rgba(0,0,0,.73), 0px 0px 18px 0px rgba(0,0,0,.13);
    box-shadow: 0px 1px 3px 0px rgba(0,0,0,.73), 0px 0px 18px 0px rgba(0,0,0,.13);
    cursor: pointer;
}

js:

$(‘#cnblogs_post_body‘).append(‘<div id="blog_catalog_open" class="blog_catalog_open">展开目录</div>‘);
$(‘#cnblogs_post_body‘).append(‘<div id="blog_catalog" class="blog_catalog"><ul><li><a id="blog_catalog_close" class="blog_catalog_close">>折叠目录</a></li></ul></div>‘);

var id = 1;
$(‘#cnblogs_post_body h1‘).each(function(){
    $(this).attr(‘id‘,‘blog_catalog_id_‘+id);
    $(‘#blog_catalog ul‘).append(‘<li><a href="#blog_catalog_id_‘+id+‘">‘+$(this).text()+‘</a></li>‘);
    id++;
});

$(‘#blog_catalog_open‘).click(function(){
$(‘#blog_catalog‘).show();
$(‘#blog_catalog_open‘).hide();
});

$(‘#blog_catalog_close‘).click(function(){
$(‘#blog_catalog‘).hide();
$(‘#blog_catalog_open‘).show();
});

如何使用

<h1>你可以随意设置你的标题</h1>

没错,就是这么简单,其他什么都不需要。

我不只要用目录,我还要完整皮肤

先声明,我这套皮肤是从别人那扒下来的一个雏形然后自己再改了不少地方。但是从哪里弄来的,忘了。。。很尴尬。

具体设置皮肤的也是一抓一大把就不多说了,上干货。

1.博客皮肤 选择 Custom

2.页面定制css代码

@charset "utf-8";
/* CSS Document */
/* By rhinoc.cnblogs.com*/

/*第一部分*/
#EntryTag {
    margin-top: 20px;
    font-size: 9pt;
    color: gray;
}

.topicListFooter {
    text-align: right;
    margin-right: 10px;
    margin-top: 10px;
}

#divRefreshComments {
    text-align: right;
    margin-right: 10px;
    margin-bottom: 5px;
    font-size: 9pt;
}

/*全局样式*/
{
    margin: 0;
    padding: 0;
}

html {
    height: 100%;
}

body {
    background-image: url(http://images0.cnblogs.com/blog2015/618672/201508/201613472223856.png);
    background-repeat: repeat;
    font-family: ‘Lucida Console‘,Georgia,‘Microsoft YaHei‘,Microsoft YaHei;
    \5B8B\4F53, sans-serif;
    font: ‘Lucida Console‘,Georgia,‘Microsoft YaHei‘,Microsoft YaHei;
    font-size: 11.5px;
    min-height: 101%;
}

table {
    border-collapse: collapse;
    border-spacing: 0;
}

fieldset, img {
    border: 0;
}

ul {
    word-break: break-all;
}

li {
    list-style: none;
}

h1, h2, h3, h4, h5, h6 {
    font-size: 100%;
    font-weight: normal;
}

a {
    outline: none;
    color: #21759b;
}

address, cite, dfn, em, var {
    font-style: normal;
}

code, kbd, pre, samp, tt {
    font-family: "Courier New", Courier,Microsoft Yahei, monospace;
}

.clear {
    clear: both;
}

/*第三部分*/
/*home和头部*/
#home {
    margin: 0 auto;
    width: 65%;
    min-width: 1000px;
    background-color: #fff;
    padding: 30px;
    margin-top: 50px;
    margin-bottom: 50px;
    box-shadow: 0px 1px 10px #999;
    -moz-box-shadow: 0px 1px 10px #999;
    -web-kit-shadow: 0px 1px 10px #999;
}

#header {
    padding-bottom: 5px;
    margin-top: 20px;
}

#blogTitle {
    height: 50px;
    clear: both;
    font-family: Georgia,Serif;
}

#InkBlogLogo {
    display: none;
}

/*博客名称*/
#blogTitle h1 {
    font-size: 28px;
    font-weight: bold;
    line-height: 0.2em;
    margin-top: 20px;
}

    #blogTitle h1 a {
        color: #515151;
    }

        #blogTitle h1 a:hover {
            color: #21759b;
        }

#blogTitle h2 {
    font-weight: normal;
    font-size: 14.5px;
    line-height: 0.3em;
    color: #515151;
    float: left;
    margin-left: 2em;
    margin-bottom: 2em;
}

#blogLogo {
    float: right;
}

/*导航栏*/
#navigator {
    text-decoration: none;
    font-size: 14px;
    font-family: ‘Lucida Console‘,Georgia,‘FZYaoTi‘,Microsoft YaHei;
    \5B8B\4F53, sans-serif;
    font: ‘Lucida Console‘,Georgia,‘FZYaoTi‘,Microsoft YaHei;
    border-bottom: 1px solid #515151;
    border-top: 1px solid #515151;
    height: 80px;
    clear: both;
    margin-top: 20px;
}

#navList {
    width: 1200px;
    min-height: 30px;
    float: left;
}

    #navList .border {
        height: 28px;
        position: absolute;
        width: 5px;
        left: 0px;
        top: 0px;
        overflow: hidden;
        opacity: 0;
        background: #F90;
        -webkit-transition: 0.3s all ease;
        -moz-transition: 0.3s all ease;
        -ms-transition: 0.3s all ease;
        -o-transition: 0.3s all ease;
        -webkit-transition: .5s left ease;
    }

    #navList li {
        float: left;
        margin: 0px,40px,0px,0px;
        -webkit-transition: 0.3s all ease;
        -moz-transition: 0.3s all ease;
        -ms-transition: 0.3s all ease;
        -o-transition: 0.3s all ease;
        transition: 0.3s all ease;
        overflow: hidden;
        position: relative;
    }

        #navList li:hover {
            background: #000;
            box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4);
        }

            #navList li:hover .border {
                opacity: 1;
                left: 65px;
            }

            #navList li:hover a {
                color: #FFF;
                text-shadow: 1px 2px 4px #333;
            }

            #navList li:hover .menu {
                -webkit-animation-name: shake;
                -moz-animation-name: shake;
            }

.menu {
    -webkit-animation: .5s .2s ease both;
    -moz-animation: 1s .2s ease both;
}

@-webkit-keyframes shake {
    0%,100% {
        -webkit-transform: translateX(0);
    }

    20%,60% {
        -webkit-transform: translateX(-10px);
    }

    40%,80% {
        -webkit-transform: translateX(10px);
    }
}

@-moz-keyframes shake {
    0%,100% {
        -moz-transform: translateX(0);
    }

    20%,60% {
        -moz-transform: translateX(-10px);
    }

    40%,80% {
        -moz-transform: translateX(10px);
    }
}

#navList a {
    text-decoration: none;
    display: block;
    width: 5em;
    height: 20px;
    float: left;
    text-align: center;
    font-weight: bold;
    padding-top: 8px;
    color: #515151;
}

.blogStats {
    float: right;
    font-style: italic;
    font-family: Georgia,‘FZYaoTi‘,Microsoft YaHei;
    \5B8B\4F53, sans-serif;
    color: #757575;
    margin-right: 1px;
    text-align: right;
}

/*主页文章列表*/
#main {
    width: 100%;
    text-align: left;
    margin-top: 10px;
}

#mainContent .forFlow {
    margin-left: 22em;
    float: none;
    width: auto;
}

#mainContent {
    min-height: 200px;
    padding: 0px 0px 10px 0;
    -o-text-overflow: ellipsis;
    text-overflow: ellipsis;
    overflow: hidden;
    word-break: break-all;
    float: left;
    margin-left: -22em;
    margin-top: 0;
    width: 100%;
}

/*日期*/
.day {
    text-decoration: none;
    background: #FFF;
    padding: 20px;
    margin-bottom: -1px;
    color: #515151;
    font-size: 21px;
    line-height: 1.5em;
    float: left;
    clear: right;
}

    .day:hover {
        border: 1px solid #21759B;
        position: relative;
        z-index: 10;
    }

        .day:hover .postSeparator {
            border-top: 1px dashed #515151;
        }

.dayTitle {
    text-decoration: none;
}

    .dayTitle a {
        text-decoration: none;
        color: #515151;
        font-size: 13px;
        font-weight: bold;
        font-family: Georgia,Consolas,Microsoft YaHei, monospace;
    }

/*文章标题*/
.postTitle {
    font-family: Georgia,‘Consolas‘,‘FZYaoTi‘,‘STHeiti‘,Microsoft YaHei;
    \5B8B\4F53, sans-serif;
    font: ‘Lucida Console‘,Georgia,‘Microsoft YaHei‘,Microsoft YaHei;
    margin-bottom: 10px;
    font-size: 20px;
    font-weight: bold;
    float: right;
    width: 100%;
    clear: both;
}

    .postTitle a:link, .postTitle a:visited, .postTitle a:active {
        color: #21759b;
        font-weight: bold;
        transition: all 0.4s linear 0s;
    }

    .postTitle a:hover {
        text-decoration: none;
        margin-left: 30px;
        font-weight: bold;
        color: #45bcf9;
    }

.postTitle2 {
    text-decoration: none;
    font-size: 20px;
    font-weight: bold;
    font-family: Georgia,‘Consolas‘,‘FZYaoTi‘,‘STHeiti‘,Microsoft YaHei;
    \5B8B\4F53, sans-serif;
    font: ‘Lucida Console‘,Georgia,‘Microsoft YaHei‘,Microsoft YaHei;
    padding-right: 64px;
    padding-left: 10px;
    border-left-style: solid;
    border-left-width: 3px;
    border-left-color: #515151;
}

.postCon {
    float: right;
    line-height: 1.5em;
    width: 100%;
    clear: both;
    padding: 10px 0;
}

.day .postTitle a {
    padding-left: 10px;
}

.postDesc {
    border-right: 3px solid #21759b;
    font-size: 12px;
    color: #21759b;
    float: right;
    width: 100%;
    clear: both;
    text-align: right;
    padding-left: 20px;
    padding-right: 5px;
    margin-top: 20px;
    line-height: 1.5;
}

    .postDesc a:link, .postDesc a:visited, .postDesc a:active {
        color: #666;
    }

    .postDesc a:hover {
        color: #21759b;
        text-decoration: none;
    }

.postSeparator {
    clear: both;
    height: 1px;
    width: 100%;
    clear: both;
    float: right;
    margin: 0 auto 15px auto;
}

/*侧边栏*/
#sideBar {
    margin-top: -15px;
    width: 240px;
    min-height: 200px;
    padding: 0px 0 0px 5px;
    float: right;
    -o-text-overflow: ellipsis;
    text-overflow: ellipsis;
    overflow: hidden;
    word-break: break-all;
}

    #sideBar a {
        color: #757575;
    }

        #sideBar a:hover {
            color: #21759b;
        }

.mySearch {
    background: #FFF;
}

.catListTitle {
    font-size: 16px;
    background-color: #169FE6;
    color: white;
    font-weight: normal;
    margin-bottom: 5px;
}

.catListEssay ul li {
    font-size: 12px;
    font-weight: normal;
    margin-left: -2.3em;
}

.liScore {
    font-family: Georgia,‘Consolas‘,‘FZYaoTi‘,‘STHeiti‘,Microsoft YaHei;
    font-size: 12px;
    font-weight: normal;
    margin-left: -2.3em;
}

.liRank {
    font-family: Georgia,‘Consolas‘,‘FZYaoTi‘,‘STHeiti‘,Microsoft YaHei;
    font-size: 12px;
    font-weight: normal;
    margin-left: -2.3em;
}

.catListTag {
    text-decoration: none;
    background: #FFF;
    margin-top: 10px;
    margin-bottom: 20px;
}

    .catListTag ul {
        border-top: none;
    }

        .catListTag ul li {
            line-height: 44px;
            margin-left: -30px;
            color: #7e8c8d;
        }

.catListPostArchive {
    background: #FFF;
}

    .catListPostArchive ul {
        border-top: none;
    }

        .catListPostArchive ul li {
            line-height: 44px;
            color: #7e8c8d;
            margin-left: -30px;
        }

.catListArticleCategory {
    width: 290px;
    padding-top: 20px;
    background: #FFF;
    margin-top: 20px;
}

.catListImageCategory {
    width: 290px;
    padding-top: 20px;
    background: #FFF;
    margin-top: 20px;
}

.catListComment {
    background: #FFF;
    margin-top: 20px;
}

#RecentCommentsBlock {
    padding: 10px;
    border: 1px solid #dedede;
    border-top: none;
}

.recent_comment_title {
    font-size: 15px;
    color: #7e8c8d;
}

.recent_comment_body, .recent_comment_author {
    border-bottom: 1px solid #E9E9E9;
    color: #9fa4a4;
    font-size: 13px;
}

.recent_comment_body {
    border-bottom: none;
}

.catListView {
    background: #FFF;
    margin-top: 20px;
}

#TopViewPostsBlock {
    padding: 10px;
    border: 1px solid #dedede;
    border-top: none;
}

.catListView ul li {
    border-bottom: 1px solid #E9E9E9;
    margin-left: -30px;
    margin-bottom: 5px;
}

.catListFeedback {
    background: #FFF;
    margin-top: 20px;
}

#TopFeedbackPostsBlock {
    padding: 10px;
    border-top: none;
}

.catListFeedback ul li {
    margin-left: -30px;
}

.catListLink {
    display: none;
}

.clearFix:after {
    clear: both;
    display: block;
    height: 0;
    line-height: 0;
    content: "";
    visibility: hidden;
}

#myding {
    background: #99B16B;
    display: none;
}

#myadd:hover {
    opacity: 1;
}

#goto-top:hover {
    background: url(http://images.cnblogs.com/cnblogs_com/Li-Cheng/554829/o_goto-top.png) no-repeat 0 -36px;
}

/*日历控件样式*/
#blog-calendar {
    float: center;
    width: 238px;
    margin-top: 20px;
    padding-bottom: 5px;
    margin-bottom: 20px;
    box-shadow: 0 1px 1px #ccc;
}

    #blog-calendar td {
        font-size: 12px;
        font-family: "Comic Sans MS";
    }

    #blog-calendar th {
        font-size: 12px;
    }

#calendar {
    width: 238px;
    padding-bottom: 5px;
    margin-bottom: 35px;
    box-shadow: 0 1px 1px #ccc;
}

    #calendar .Cal {
        width: 100%;
        line-height: 1.5em;
    }

    #calendar td {
        font-family: "Comic Sans MS";
        background: #FFFFFF;
        padding-top: 2px;
    }

.Cal {
    border: none;
    color: #666;
    text-decoration: none;
}

#calendar table a:hover {
    color: white;
    text-decoration: none;
}

.CalTodayDay {
    background: #FFF !important;
    text-decoration: none;
}

.CalWeekendDay {
    padding-top: 4px;
    padding-bottom: 4px;
    text-decoration: none;
}

.CalOtherMonthDay {
    color: #ccc;
    padding-top: 4px;
    padding-bottom: 4px;
    text-decoration: none;
}

#calendar .CalNextPrev a:link, #calendar .CalNextPrev a:visited, #calendar .CalNextPrev a:active {
    font-weight: bold;
    padding-left: 10px;
    padding-right: 15px;
    text-decoration: none;
}

.CalDayHeader {
    background: #F8F8F8;
    font-weight: 100;
    color: #5E5F63;
    text-decoration: none;
}

.CalTitle { /**日历年月头部样式**/
    background: #6293bb;
    width: 100%;
    height: 25px;
    text-align: center;
    font-size: 14px;
    font-weight: bold;
    padding: 5px 0;
    color: #FFF;
    text-decoration: none;
}

    .CalTitle td {
        background: #F8F8F8 !important;
        border: 0px !important;
        color: #5E5F63;
        font-family: "Comic Sans MS";
        text-decoration: none;
    }

.catListTitle {
    font-size: 13px;
    padding: 10px 20px;
    background-color: #515151;
    color: white;
    font-weight: normal;
}

.catListComment {
    line-height: 1.5em;
}

.divRecentComment {
    text-indent: 2em;
    color: #494949;
    margin-bottom: 20px;
}

#sideBarMain ul {
    line-height: 1.5em;
}

#sideBarMain li {
    line-height: 1.8;
}

#widget_my_zzk {
    padding: 10px 0 0 15px;
    margin-bottom: 3px;
}

#widget_my_google {
    padding: 10px 0 15px 15px;
    margin: 0 !important;
}

.input_my_zzk {
    width: 122px;
    height: 35px;
    outline: none;
    line-height: 35px;
    font-size: 13px;
    padding: 0 5px;
}

input.btn_my_zzk {
    font-size: 13px;
    height: 37px;
    width: 70px;
    background: #515151;
    text-align: center;
    line-height: 37px;
    border: none;
    color: #FFF;
    font-family: "Microsoft Yahei", "Microsoft YaHei", Arial;
}

    input.btn_my_zzk:hover {
        cursor: pointer;
        cursor: hand;
    }

/*查看文章页面*/
#topics {
    width: 100%;
    min-height: 200px;
    padding: 0px 0px 10px 0;
    float: left;
    -o-text-overflow: ellipsis;
    text-overflow: ellipsis;
    overflow: hidden;
    word-break: break-all;
}

    #topics .postTitle {
        border: 0px;
        font-size: 130%;
        font-weight: bold;
        float: left;
        line-height: 1.5em;
        width: 100%;
        padding-left: 5px;
    }

#EntryTag {
    color: #666;
}

    #EntryTag a {
        margin-left: 5px;
        height: 20px;
        line-height: 20px;
        color: #333333;
        padding: 3px 14px;
        border-radius: 10px;
        margin: 2px 5px 0;
        background: #e7e7e7;
        text-decoration: none;
    }

        #EntryTag a:link, #EntryTag a:visited, #EntryTag a:active {
            color: #666;
        }

        #EntryTag a:hover {
            color: #f5f5f5;
            background: #21759b;
            transition: all 0.4s linear 0s;
        }

#BlogPostCategory {
    color: #666;
}

    #BlogPostCategory a {
        margin-left: 5px;
        height: 20px;
        line-height: 20px;
        color: #333333;
        padding: 3px 14px;
        border-radius: 10px;
        margin: 2px 5px 0;
        background: #e7e7e7;
        text-decoration: none;
    }

        #BlogPostCategory a:link, #BlogPostCategory a:visited, #BlogPostCategory a:active {
            color: #666;
        }

        #BlogPostCategory a:hover {
            color: #f5f5f5;
            background: #21759b;
        }

#topics .postDesc {
    padding-left: 0px;
    width: 100%;
    text-align: right;
    color: #666;
    margin-top: 5px;
    background: none;
}

.feedback_area_title {
    font: normal normal 16px/35px "Microsoft YaHei";
    margin: 10px 0 30px;
    border-bottom: 2px solid #cccccc;
}

.louzhu {
    background: transparent url(http://images0.cnblogs.com/blog2015/618672/201508/201646262696155.png) no-repeat scroll right top;
    padding-right: 16px;
}

.feedbackListSubtitle {
    color: #A8A8A8;
}

    .feedbackListSubtitle a:link, .feedbackListSubtitle a:visited, .feedbackListSubtitle a:active {
        color: #21759b;
        font-weight: bold;
    }

    .feedbackListSubtitle a:hover {
        color: #21759b;
        text-decoration: underline;
    }

    .feedbackListSubtitle b {
        color: #21759b;
    }

.feedbackManage {
    width: 200px;
    text-align: right;
    float: right;
}

.feedbackCon {
    border-bottom: 1px solid #EEE;
    padding: 10px 20px 10px 5px;
    min-height: 35px;
    _height: 35px;
    margin-bottom: 1em;
    line-height: 1.5;
}

#divRefreshComments {
    text-align: right;
    margin-bottom: 10px;
}

.commenttb {
    padding: 8px;
    margin-bottom: 10px;
    width: 50%;
    color: #555;
    border: 1px solid #ddd;
    border-radius: 3px;
    -moz-border-radius: 3px;
    -webkit-border-radius: 3px;
    width: 320px;
}

    .commenttb:hover {
        color: #333;
        border-color: rgba(82, 168, 236, 0.8);
        outline: 0;
        -webkit-box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.075), 0 0 4px rgba(82, 168, 236, 0.6);
        -moz-box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.075), 0 0 4px rgba(82, 168, 236, 0.6);
        box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.075), 0 0 4px rgba(82, 168, 236, 0.6);
        transition: all 0.4s linear 0s;
    }

.commentTextBox {
    width: 410px !important;
    margin-top: 10px;
    margin-bottom: 10px;
}

    .commentTextBox:hover {
        color: #333;
        border-color: rgba(82, 168, 236, 0.8);
        outline: 0;
        -webkit-box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.075), 0 0 4px rgba(82, 168, 236, 0.6);
        -moz-box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.075), 0 0 4px rgba(82, 168, 236, 0.6);
        box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.075), 0 0 4px rgba(82, 168, 236, 0.6);
        transition: all 0.4s linear 0s;
    }

#AjaxHolder_PostComment_btnSubmit {
    padding: 8px 20px;
    text-align: center;
    font-size: 14px;
    color: #fff;
    border: none;
    background: #21759b;
    border-radius: 3px;
    -moz-border-radius: 3px;
    -webkit-border-radius: 3px;
    -webkit-transition: all 0.4s ease;
    -moz-transition: all 0.4s ease;
    -o-transition: all 0.4s ease;
    -ms-transition: all 0.4s ease;
    transition: all 0.4s ease;
    cursor: pointer;
    display: inline-block;
    vertical-align: middle;
    outline: none;
    text-decoration: none;
}

    #AjaxHolder_PostComment_btnSubmit:hover {
        background: #333;
    }

#AjaxHolder_PostComment_divCommnentArea tr {
    margin-top: 10px;
    margin-bottom: 10px;
}

/*评论框*/
.comment_vote {
    padding-right: 10px;
}

    .comment_vote a {
        color: #999;
    }

        .comment_vote a:hover {
            color: #21759b;
        }

#commentform_title {
    font: normal normal 16px/35px "Microsoft YaHei";
    margin: 10px 0 30px;
    border-bottom: 2px solid #cccccc;
    background-image: none;
    padding: 0;
}

#comment_form_container .author {
    padding-left: 10px;
    color: #555;
    border: 1px solid #ddd;
    border-radius: 3px;
    -moz-border-radius: 3px;
    -webkit-border-radius: 3px;
    width: 320px;
    height: 20px;
    background-image: none;
}

#comment_form_container p {
    font-size: 14px;
    margin-bottom: 20px;
}

.commentbox_title_left {
    font-size: 14px;
}

.commentbox_title_right {
    float: left;
}

#comment_form_container .comment_textarea {
    width: 95%;
    height: 200px;
    font-size: 13px;
    padding: 8px;
    margin-bottom: 10px;
    color: #555;
    border: 1px solid #ddd;
    border-radius: 3px;
    -moz-border-radius: 3px;
    -webkit-border-radius: 3px;
}

    #comment_form_container .comment_textarea:hover {
        border-color: rgba(82, 168, 236, 0.8);
        outline: 0;
        transition: all 0.4s linear 0s;
    }

    #comment_form_container .comment_textarea:focus {
        outline: 0;
    }

.comment_btn {
    width: 100px;
    height: 38px;
    padding: 8px 20px;
    text-align: center;
    font-size: 14px;
    color: #fff;
    border: none;
    background: #21759b;
    border-radius: 3px;
    -moz-border-radius: 3px;
    -webkit-border-radius: 3px;
    -webkit-transition: all 0.4s ease;
    -moz-transition: all 0.4s ease;
    -o-transition: all 0.4s ease;
    -ms-transition: all 0.4s ease;
    transition: all 0.4s ease;
    cursor: pointer;
    display: inline-block;
    vertical-align: middle;
    outline: none;
    text-decoration: none;
}

    .comment_btn:hover {
        background: #333;
    }

#comment_form_container {
}

/*列表页面*/
.entrylistTitle, .PostListTitle, .thumbTitle {
    margin-bottom: 25px;
    height: 38px;
    line-height: 38px;
    font-size: 16px;
    border-bottom: 2px solid #e6e6e6;
}

color: #21759b; .entrylistDescription {
    color: #666;
    text-align: right;
    padding-top: 5px;
    padding-bottom: 5px;
    padding-right: 10px;
    margin-bottom: 10px;
}

.entrylistItem {
    min-height: 20px;
    _height: 20px;
    margin-bottom: 30px;
    padding-bottom: 50px;
    padding-top: 10px;
    width: 100%;
}

.entrylistPosttitle {
    padding-left: 15px;
    margin-bottom: 10px;
    border-left: 3px solid #21759b;
    font-size: 20px;
    width: 100%;
}

    .entrylistPosttitle a:link, .entrylistPosttitle a:visited, .entrylistPosttitle a:active {
        color: #21759b;
        transition: all 0.4s linear 0s;
    }

    .entrylistPosttitle a:hover {
        margin-left: 30px;
        color: #0f3647;
        text-decoration: none;
    }

.entrylistPostSummary {
    margin-top: 5px;
    margin-bottom: 5px;
}

.entrylistItemPostDesc {
    margin-top: 12px;
    text-align: right;
    color: #757575;
    padding-left: 5px;
}

    .entrylistItemPostDesc a:link, .entrylistItemPostDesc a:visited, .entrylistItemPostDesc a:active {
        color: #666;
    }

    .entrylistItemPostDesc a:hover {
        color: #21759b;
    }

.entrylist .postSeparator {
    clear: both;
    width: 100%;
    font-size: 0;
    line-height: 0;
    margin: 0;
    padding: 0;
    height: 0;
    border: none;
}

.divRecentCommentAticle a {
    color: #000;
}

.pager {
    text-align: right;
    margin-right: 10px;
}

    .pager a {
        box-shadow: 0 1px 3px #3671a5;
        border: 1px solid #3671a5;
        background: #3671a5;
        color: white;
        transition: all 0.4s linear 0s;
    }

        .pager a:hover {
            background: #000;
        }

.PostList {
    border-bottom: 1px solid #ccc;
    clear: both;
    min-height: 1.5em;
    _height: 1.5em;
    padding-top: 10px;
    margin-bottom: 20px;
    padding-bottom: 20px;
}

.postTitl2 {
    float: left;
    padding-top: 10px;
    padding-bottom: 10px;
    font-size: 14px;
}

.postDesc2 {
    color: #666;
    float: right;
}

.postText2 {
    clear: both;
    color: #757575;
}

/*留言*/
.pfl_feedback_area_title {
    text-align: right;
    line-height: 1.5em;
    font-weight: bold;
    margin-bottom: 10px;
}

.pfl_feedbackItem {
    border: 1px dashed #ccc;
    padding: 10px;
    border-radius: 3px;
    margin-bottom: 20px;
}

.pfl_feedbacksubtitle {
    width: 100%;
    height: 1.5em;
}

.pfl_feedbackname {
    float: left;
}

    .pfl_feedbackname a {
        color: #21759b;
        font-weight: bold;
    }

.pfl_feedbackManage {
    float: right;
}

.pfl_feedbackCon {
    color: black;
    padding-top: 5px;
    padding-bottom: 5px;
}

.pfl_feedbackAnswer {
    color: #F40;
    text-indent: 2em;
}

.tdSentMessage {
    text-align: right;
}

.errorMessage {
    width: 300px;
    float: left;
}

#Profile1_panelAdd input[type=text], #Profile1_txtContent {
    padding: 8px;
    margin-bottom: 10px;
    color: #555;
    border: 1px solid #ddd;
    border-radius: 3px;
    -moz-border-radius: 3px;
    -webkit-border-radius: 3px;
}

    #Profile1_panelAdd input[type=text]:hover, #Profile1_txtContent:hover {
        color: #333;
        border-color: rgba(82, 168, 236, 0.8);
        outline: 0;
        -webkit-box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.075), 0 0 4px rgba(82, 168, 236, 0.6);
        -moz-box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.075), 0 0 4px rgba(82, 168, 236, 0.6);
        box-shadow: inset 1px 1px 1px rgba(0, 0, 0, 0.075), 0 0 4px rgba(82, 168, 236, 0.6);
        transition: all 0.4s linear 0s;
    }

    #Profile1_panelAdd input[type=text]:focus, #Profile1_txtContent:focus {
        outline: 0;
        border-color: rgba(82, 168, 236, 0.8);
    }

#Profile1_panelAdd input[type=submit] {
    padding: 8px 20px;
    text-align: center;
    font-size: 14px;
    color: #fff;
    border: none;
    background: #21759b;
    border-radius: 3px;
    -moz-border-radius: 3px;
    -webkit-border-radius: 3px;
    -webkit-transition: all 0.4s ease;
    -moz-transition: all 0.4s ease;
    -o-transition: all 0.4s ease;
    -ms-transition: all 0.4s ease;
    transition: all 0.4s ease;
    cursor: pointer;
    display: inline-block;
    vertical-align: middle;
    outline: none;
    text-decoration: none;
}

    #Profile1_panelAdd input[type=submit]:hover {
        background: #333;
    }

.feedbackListSubtitle {
    clear: both;
    color: #A8A8A8;
    padding: 8px 5px;
}

.feedbackItem {
    margin-top: 30px;
}

.divPhoto {
    border: 1px solid #ccc;
    padding: 2px;
    margin-right: 10px;
}

.thumbDescription {
    color: #757575;
    text-align: right;
    padding-top: 5px;
    padding-bottom: 5px;
    padding-right: 10px;
    margin-bottom: 30px;
}

#footer {
    color: #686868;
    text-align: center;
    min-height: 15px;
    _height: 15px;
    border-top: 1px solid #ededed;
    margin-top: 50px;
    padding-top: 10px;
    margin-bottom: 10px;
}

/*留言查看页面的个人信息*/
.personInfo {
    margin-bottom: 20px;
}

/*留言分页区域*/
.pages {
    text-align: right;
}

#RSignature {
    border-top: #45bcf9 1px dashed;
    border-right: #45bcf9 1px dashed;
    border-bottom: #45bcf9 1px dashed;
    border-left: #45bcf9 1px dashed;
    padding-top: 12px;
    padding-right: 12px;
    padding-bottom: 12px;
    padding-left: 140px;
    color: #FFFFFF;
    font-family: 微软雅黑;
    font-size: 14px;
    background: url(http://images0.cnblogs.com/blog2015/618672/201508/201508126601957.png) #45bcf9 no-repeat 1% 30%;
}

    #RSignature a {
        color: white;
    }

    #RSignature div {
        line-height: 25px;
    }

/*第四部分:文章内容常用标签格式*/
/*文章内部常用标签格式*/
.postBody {
    color: #000;
    line-height: 1.7;
    font-size: 14px;
}

    .postBody p, .postCon p {
        text-indent: 2em;
        margin: 0 auto 1em auto;
    }

    .postBody h2 {
        font-size: 150%;
        margin: 15px auto 2px auto;
        font-weight: bold;
    }

    .postBody h3 {
        font-size: 120%;
        margin: 15px auto 2px auto;
        font-weight: bold;
    }

    .postBody h4 {
        background-color: #515151;
        color: white;
        text-shadow: 0 1px rgba(33, 117, 188, 0.5);
        font-family: Consolas, Microsoft YaHei, ‘Andale Mono‘, monospace;
        direction: ltr;
        text-align: center;
        white-space: pre;
        word-spacing: normal;
        word-break: normal;
        line-height: 1.5;
        padding: 1em;
        margin: .5em 0;
        overflow: auto;
        border-radius: 0.5em;
        -moz-tab-size: 4;
        -o-tab-size: 4;
        tab-size: 4;
        -webkit-hyphens: none;
        -moz-hyphens: none;
        -ms-hyphens: none;
        hyphens: none;
        font-size: 16.5px;
        margin-top: 3em;
    }

    .postBody h5 {
        font-size: 100%;
        margin: 15px auto 2px auto;
        font-weight: bold;
        color: #333;
    }

    .postBody a:link, .postBody a:visited, .postBody a:active {
        text-decoration: underline;
    }

.postCon a:link, .postCon a:visited, .postCon a:active {
    text-decoration: underline;
}

.postBody ul, .postCon ul {
    margin-left: 2em;
}

.postBody li, .postCon li {
    list-style-type: disc;
}

.postBody blockquote {
    background-repeat: no-repeat;
    quotes: "\201C""\201D""\2018""\2019";
}

blockquote:before {
    color: #ccc;
    content: open-quote;
    font-size: 4em;
    line-height: .1em;
    vertical-align: -.4em;
}

blockquote p {
    display: inline;
}

.buryit {
    background: url(http://i1.tietuku.com/c1d363061fa080f2.png) no-repeat;
}

.burynum {
    display: none;
}

#author_profile {
    display: none;
}

#green_channel {
    float: left;
}

#div_digg {
    float: right;
}

.myposts_title {
    font-weight: bold;
    text-align: center;
}

#sideBar {
    font-size: 12px;
}

    #sideBar h3 {
        font-size: 14px;
    }

.c_b_p_desc {
    font-size: 14px;
    line-height: 1.7;
}

/*页脚下一页*/
#nav_next_page {
    line-height: 50px;
}

    #nav_next_page a {
        background-color: #515151;
        height: 40px;
        line-height: 40px;
        color: #fff;
        display: inline-block;
        padding: 0 25px;
        text-decoration: none;
    }

/*隐藏多余信息*/
#ad_text_under_commentbox, #ad_under_post_holder {
    display: none;
}

/*顶一下*/
.diggnum {
    font-size: 28px;
    color: #6DA47D;
    font-family: ‘Microsoft Yahei‘;
}

#div_digg {
    position: fixed;
    right: 180px;
    bottom: 20px;
    z-index: 9999;
    background-color: #fff;
    font-size: 12px;
    width: 125px;
    margin: 10px 0 0 0;
    padding: 5px;
    text-align: center;
    border: 3px solid #55895b;
    border-radius: 5px;
}

.diggit {
    float: left;
    width: 128px;
    height: 128px;
    background: url(‘http://images.cnblogs.com/cnblogs_com/libaoheng/305804/o_dig.gif‘) no-repeat;
    background-position: 0 0;
    text-align: center;
    cursor: pointer;
}

    .diggit:hover {
        background-position: -128px 0;
    }

.postBody h1 {
    border-left: 5px solid #e84c3d;
    padding-left: 10px;
    background-color: #ECECEC;
}

.postBody h2 {
    padding-left: 20px;
    border-bottom: 1px dashed #f00;
    color: transparent;
    background-color: black;
    text-shadow: rgba(255,255,255,0.5) 0 5px 6px, rgba(255,255,255,0.2) 1px 3px 3px;
    -webkit-background-clip: text;
}

.blog_catalog {
    display: none;
    width: auto;
    height: auto;
    float: right;
    position: fixed;
    right: 180px;
    bottom: 200px;
    z-index: 9999;
    background-color: #fff;
    font-size: 12px;
    margin: 10px 0 0 0;
    padding: 5px;
    text-align: center;
    border: 3px solid #55895b;
    border-radius: 5px;
    -webkit-box-shadow: 0px 1px 3px 0px rgba(0,0,0,.73), 0px 0px 18px 0px rgba(0,0,0,.13);
    -moz-box-shadow: 0px 1px 3px 0px rgba(0,0,0,.73), 0px 0px 18px 0px rgba(0,0,0,.13);
    box-shadow: 0px 1px 3px 0px rgba(0,0,0,.73), 0px 0px 18px 0px rgba(0,0,0,.13);
}

    .blog_catalog > li > a {
        background-color: #616975;
        background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(114, 122, 134)),to(rgb(80, 88, 100)));
        background-image: -webkit-linear-gradient(top, rgb(114, 122, 134), rgb(80, 88, 100));
        background-image: -moz-linear-gradient(top, rgb(114, 122, 134), rgb(80, 88, 100));
        background-image: -o-linear-gradient(top, rgb(114, 122, 134), rgb(80, 88, 100));
        background-image: -ms-linear-gradient(top, rgb(114, 122, 134), rgb(80, 88, 100));
        background-image: linear-gradient(top, rgb(114, 122, 134), rgb(80, 88, 100));
        filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,StartColorStr=‘#727a86‘, EndColorStr=‘#505864‘);
        -webkit-box-shadow: inset 0px 1px 0px 0px #878e98;
        -moz-box-shadow: inset 0px 1px 0px 0px #878e98;
        box-shadow: inset 0px 1px 0px 0px #878e98;
        width: 100%;
        height: 2.75em;
        line-height: 2.75em;
        text-indent: 2.75em;
        display: block;
        position: relative;
        font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
        font-weight: 600;
        color: #fff;
        text-shadow: 0px 1px 0px rgba(0,0,0,.5);
    }

    .blog_catalog ul li a {
        background: #fff;
        border-bottom: 1px solid #efeff0;
        width: 100%;
        height: 2.75em;
        line-height: 2.75em;
        display: block;
        position: relative;
        font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
        font-size: 0.923em;
        font-weight: 400;
        color: #878d95;
    }

        .blog_catalog ul li a:hover {
            cursor: pointer;
        }

    .blog_catalog > li > a:hover, .blog_catalog > li > a.active, .blog_catalog > li:target > a; /*add this*/ {
        background-color: #35afe3;
        background-image: -webkit-gradient(linear, left top, left bottom, from(rgb(69, 199, 235)),to(rgb(38, 152, 219)));
        background-image: -webkit-linear-gradient(top, rgb(69, 199, 235), rgb(38, 152, 219));
        background-image: -moz-linear-gradient(top, rgb(69, 199, 235), rgb(38, 152, 219));
        background-image: -o-linear-gradient(top, rgb(69, 199, 235), rgb(38, 152, 219));
        background-image: -ms-linear-gradient(top, rgb(69, 199, 235), rgb(38, 152, 219));
        background-image: linear-gradient(top, rgb(69, 199, 235), rgb(38, 152, 219));
        filter: progid:DXImageTransform.Microsoft.gradient(GradientType=0,StartColorStr=‘#45c7eb‘, EndColorStr=‘#2698db‘);
        border-bottom: 1px solid #103c56;
        -webkit-box-shadow: inset 0px 1px 0px 0px #6ad2ef;
        -moz-box-shadow: inset 0px 1px 0px 0px #6ad2ef;
        box-shadow: inset 0px 1px 0px 0px #6ad2ef;
    }

    .blog_catalog > li > a.active {
        border-bottom: 1px solid #1a638f;
    }

    .blog_catalog > li > a:before {
        content: ‘‘;
        background-image: url(../images/sprite.png);
        background-repeat: no-repeat;
        font-size: 36px;
        height: 1em;
        width: 1em;
        position: absolute;
        left: 0;
        top: 50%;
        margin: -.5em 0 0 0;
    }

.item1 > a:before {
    background-position: 0 0;
}

.item2 > a:before {
    background-position: -38px 0;
}

.item3 > a:before {
    background-position: 0 -38px;
}

.item4 > a:before {
    background-position: -38px -38px;
}

.item5 > a:before {
    background-position: -76px 0;
}

.blog_catalog > li > a span {
    font-size: 0.857em;
    display: inline-block;
    position: absolute;
    right: 1em;
    top: 50%;
    background: #48515c;
    line-height: 1em;
    height: 1em;
    padding: .4em .6em;
    margin: -.8em 0 0 0;
    color: #fff;
    text-indent: 0;
    text-align: center;
    -webkit-border-radius: .769em;
    -moz-border-radius: .769em;
    border-radius: .769em;
    -webkit-box-shadow: inset 0px 1px 3px 0px rgba(0, 0, 0, .26), 0px 1px 0px 0px rgba(255, 255, 255, .15);
    -moz-box-shadow: inset 0px 1px 3px 0px rgba(0, 0, 0, .26), 0px 1px 0px 0px rgba(255, 255, 255, .15);
    box-shadow: inset 0px 1px 3px 0px rgba(0, 0, 0, .26), 0px 1px 0px 0px rgba(255, 255, 255, .15);
    text-shadow: 0px 1px 0px rgba(0,0,0,.5);
    font-weight: 500;
}

.blog_catalog > li > a:hover span,
.blog_catalog > li a.active span,
.blog_catalog > li:target > a span /*add this*/ {
    background: #2173a1;
}

.blog_catalog > li > ul li a:before {
    font-size: 8px;
    color: #bcbcbf;
    position: absolute;
    width: 1em;
    height: 1em;
    top: 0;
    left: -2.7em;
}

.blog_catalog > li > ul li:hover a,
.blog_catalog > li > ul li:hover a span,
.blog_catalog > li > ul li:hover a:before {
    color: #32373D;
}

.blog_catalog ul > li > a span {
    font-size: 0.857em;
    display: inline-block;
    position: absolute;
    right: 1em;
    top: 50%;
    / background: #fff;
    border: 1px solid #d0d0d3;
    line-height: 1em;
    height: 1em;
    padding: .4em .7em;
    margin: -.9em 0 0 0;
    color: #878d95;
    text-indent: 0;
    text-align: center;
    -webkit-border-radius: .769em;
    -moz-border-radius: 769em;
    border-radius: 769em;
    text-shadow: 0px 0px 0px rgba(255,255,255,.01));
}

/*additional*/

.blog_catalog > li > ul {
    height: 0;
    overflow: hidden;
    opacity: 0;
    filter: alpha(opacity=0); /* IE6-IE8 */
    -webkit-transition: opacity 0.9s ease-in-out;
    -moz-transition: opacity 0.9s ease-in-out;
    -o-transition: opacity 0.9s ease-in-out;
    -ms-transition: opacity 0.9s ease-in-out;
    transition: opacity 0.9s ease-in-out;
}

.blog_catalog > li:target > ul {
    height: auto; /*using auto nullifies the height transitions, but it makes things flexible which is more important*/
    border-bottom: 1px solid #51555a;
    opacity: 1;
    filter: alpha(opacity=100); /* IE6-IE8 */
}

#cnblogs_post_body ul li {
    list-style-type: none;
    margin-left: -30px;
}

.blog_catalog_open {
    width: auto;
    height: auto;
    float: right;
    position: fixed;
    right: 180px;
    bottom: 200px;
    z-index: 9999;
    background-color: #fff;
    font-size: 12px;
    width: 125px;
    margin: 10px 0 0 0;
    padding: 5px;
    text-align: center;
    border: 3px solid #55895b;
    border-radius: 5px;
    -webkit-box-shadow: 0px 1px 3px 0px rgba(0,0,0,.73), 0px 0px 18px 0px rgba(0,0,0,.13);
    -moz-box-shadow: 0px 1px 3px 0px rgba(0,0,0,.73), 0px 0px 18px 0px rgba(0,0,0,.13);
    box-shadow: 0px 1px 3px 0px rgba(0,0,0,.73), 0px 0px 18px 0px rgba(0,0,0,.13);
    cursor: pointer;
}

3.页角html代码

<script>
var digg = $(‘#mainContent‘);//the element I want to monitor
digg.bind(‘DOMNodeInserted‘, function(e) {
$(‘.buryit‘).remove();
});

$(‘#navList‘).children().each(function(){
$(this).prepend(‘<div class="border"></div>‘);
});

$(‘#cnblogs_post_body‘).append(‘<div id="blog_catalog_open" class="blog_catalog_open">展开目录</div>‘);
$(‘#cnblogs_post_body‘).append(‘<div id="blog_catalog" class="blog_catalog"><ul><li><a id="blog_catalog_close" class="blog_catalog_close">>折叠目录</a></li></ul></div>‘);

var id = 1;
$(‘#cnblogs_post_body h1‘).each(function(){
    $(this).attr(‘id‘,‘blog_catalog_id_‘+id);
    $(‘#blog_catalog ul‘).append(‘<li><a href="#blog_catalog_id_‘+id+‘">‘+$(this).text()+‘</a></li>‘);
    id++;
});

$(‘#blog_catalog_open‘).click(function(){
$(‘#blog_catalog‘).show();
$(‘#blog_catalog_open‘).hide();
});

$(‘#blog_catalog_close‘).click(function(){
$(‘#blog_catalog‘).hide();
$(‘#blog_catalog_open‘).show();
});
</script>

时间: 2024-11-06 02:49:42

【轮子狂魔】手把手教你用JS给博客动态增加目录 - 超级懒人版的相关文章

手把手教你建github技术博客by hexo

适合人群 喜欢写Blog的人 有一定的编程基础 爱折腾的人 熟练使用版本控制Git 了解使用Github 熟悉基本的MarkDown语法 环境准备 安装Git 下载 msysgit 并执行即可完成安装. 安装Node.js 在 Windows 环境下安装 Node.js 非常简单,仅须下载安装文件并执行即可完成安装. 安装hexo 利用 npm 命令即可安装.(在任意位置点击鼠标右键,选择Git bash) npm install -g hexo 问题 * npm ERR! registry e

手把手教你搭建HEXO免费博客

一.环境搭建 node安装 百度搜索node,进入官网.下载稳定版: 下载好后直接打开安装 我这里将其安装在D盘(可以自己选择安装位置) 可以看到安装包中已经自带npm包管理工具 等待安装完成后,WIN+R打开运行对话框.输入cmd带开命令行控制程序. 输入node -v命令检测node是否安装成功.成功会显示出版本号 github注册 百度搜索github,进入官网注册.(注意:用户名跟你的博客域名有关,请慎重取名) 选择free 点击start 会叫你去验证邮箱 进入注册的邮箱,打开gith

使用CSS和JS自定义博客风格

使用以下css代码,具体功能已作注释 /*隐藏页面底部的 最新IT新闻 和 最新知识库文章 */ #under_post_news { display:none; } #under_post_kb { display:none; } /*修改文章title的字体等*/ .postTitle { font-size:20px; font-family:黑体; } /*不显示评论框(慎用)*/ #comment_form_container { display:none; } /*导航栏变色*/ #

Vue.js实践:一个Node.js+mongoDB+Vue.js的博客内容管理系统

项目来源 以前曾用过WordPress搭建自己的博客网站,但感觉WordPress很是臃肿.所以一直想自己写一个博客内容管理器. 正好近日看完了Vue各个插件的文档,就用着Vue尝试写了这个简约的博客内容管理器(CMS). 嗯,我想完成的功能: 一个基本的博客内容管理器功能,如后台登陆,发布并管理文章等 支持markdown语法实时编辑 支持代码高亮 管理博客页面的链接 博客页面对移动端适配优化 账户管理(修改密码) Demo 登陆后台按钮在页面最下方"站长登陆",可以以游客身份登入后

基于node.js的博客搭建

一个博客应当具备哪些功能? 前台展示 点击下一页,可以点击分类导航. 可以点击进入到具体博文页面 下方允许评论.显示发表时间.允许留言分页. 右侧有登录注册界面. 后台管理 管理员账号:登陆后看到页面不一样,有后台页面. 允许添加新的分类.从后台添加新的文章. 编辑允许markdown写法. 评论管理. 安装模块 Express 一个简洁灵活的node.js WEB应用框架,提供一系列强大的特性帮助我们创建web应用. Mongodb 用于保存产生的数据 第三方模块和中间件: bodyParse

用 zoom.js 给博客园中博文的图片添加单击时弹出放大效果

1.写在前面 由于博客园本身不提供的上传图片后提供单击图片放大的功能,但是我们看到了有些博文却拥有放大图片的功能,自己也想拥有此项功能怎么办呢?博客园的好处就是提供了自定义功能了,具体是怎么实现的呢? 首先我们打开我的博客——管理——设置——申请到JS权限. 拿到权限后,接着去github下载zoom.js功能文件...... 下载解压取出zoom.js和zoom.css文件,将俩个文件上传到——我的博客——管理——文件:如图 点击进入文件,复制URL,如:https://blog-static

Node.js Express博客项目实战 之 系统设置

系统设置在侧边栏的系统管理中: 在视图views的后台index.html中对应的系统设置写入跳转的路由: <li><a href="/admin/system" target="right"><span class="icon-caret-right"></span>系统设置</a></li> 在后台路由中进行注册该路由system.js // 系统管理 let syste

node.js开发博客系统前端项目搭建(一)

Express: https://github.com/petecoop/generator-express 安装node.js和npm 执行: npm install -g yo npm install -g generator-express 执行:yo 创建项目成功. 项目的目录: brew安装:MongoDb http://blog.csdn.net/moumaobuchiyu/article/details/54885306 http://www.cnblogs.com/junqili

原生js的博客

原生js一里边还有很多二三等http://www.cnblogs.com/charling/p/3527561.html 选区器 http://wenku.baidu.com/link?url=zr2n0qHcXqDtFuKmDy_K5DDnUeY4HIHHTnhAve9GTewQvrdysIjvQNPy9Ji5b5xtxdbprh7oi-o05F6E-99ONksQsk5LcBHRVYU7VA5v7IS http://www.jb51.net/article/56316.htm http://