码迷,mamicode.com
首页 > 其他好文 > 详细

rer

时间:2018-05-29 20:41:56      阅读:398      评论:0      收藏:0      [点我收藏+]

标签:gen   feedback   length   i++   label   ado   atl   logs   margin   

/*sideBar博客侧边栏容器*/
#sideBar {
    width: 300px;
    box-sizing: border-box;
    margin-left: 30px;
function GenerateContentList() {
        var jquery_h3_list = $(‘#cnblogs_post_body h2‘);//如果你的章节标题不是h2,只需要将这里的h2换掉即可
        if (jquery_h3_list.length > 0) {
            var content = ‘‘;
            content += ‘<div id="navCategory">‘;
            content += ‘<p><b>文章目录</b></p>‘;
            content += ‘<ul>‘;
            for (var i = 0; i < jquery_h3_list.length; i++) {
                var go_to_top = ‘<div style="text-align: right;    text-align: right;height: 0;padding: 0;overflow: hidden;visibility: hidden;"><a name="_label‘ + i + ‘"></a></div>‘;
                $(jquery_h3_list[i]).before(go_to_top);
                var li_content = ‘<li><a href="#_label‘ + i + ‘">‘ + $(jquery_h3_list[i]).text() + ‘</a></li>‘;
                content += li_content;
            }
            content += ‘</ul>‘;
            content += ‘</div>‘;
            if ($(‘#cnblogs_post_body‘).length != 0) {
                $($(‘#cnblogs_post_body‘)[0]).prepend(content);
            }
        }
    }
    GenerateContentList();

 


    padding: 0;
}

.newsItem, .catListComment, .catListEssay, .catListView, .catListFeedback,
#blog-calendar, #sidebar_postcategory, #sidebar_postcategory, #sidebar_postarchive, #sidebar_search {
    /*侧边栏每一模块添加圆角和阴影*/
    border-radius: 10px;
    box-shadow: 1px 2px 3px #A7A8AD;
    background-color: #fff;
}

#sideBarMain h3, .newsItem h3 {
    /*侧边栏每个模块的标题部分*/
    font-size: 1.2em;
    height: 50px;
    line-height: 50px;
    text-indent: 0.5em;
    background: url(http://www.cnblogs.com/skins/red_autumnal_leaves/images/titlebg.png) no-repeat left center #fff;
    padding: 0 0 0 50px;
    margin-bottom: 0;
    border: 1px solid #55895B;
    border-left-width: 5px;
    border-radius: 10px;
    border-right-width: 5px;
}

/*侧边栏列表样式*/
#sideBarMain ul {
    background-color: #fff;
    padding: 15px 20px;
    border-bottom-left-radius: 10px;
    border-bottom-right-radius: 10px;
}

#sideBarMain li {
    line-height: 40px;
    border-bottom: 1px solid #ddd;
    font-size: 14px;
}

 

rer

标签:gen   feedback   length   i++   label   ado   atl   logs   margin   

原文地址:https://www.cnblogs.com/lidehua979331/p/9107465.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!