1. 程式人生 > 實用技巧 >關於我的部落格園面板效果

關於我的部落格園面板效果

一些朋友和我要我的部落格園的面板效果,其實我的效果也是參考一些大佬,複製貼上過來的,哈哈哈哈哈,主要我個人比較喜歡二次元風格,如果有喜歡的朋友可以自取哈。

在設定的側邊欄程式碼中插入我的程式碼就可以了(需要申請js許可權)

<script type="text/javascript">
        var a_idx = 0;
        jQuery(document).ready(function($) {
        $("body").click(function(e) {
        var a = new Array("❤喜歡就關注一下吧❤","❤不是點這裡哦❤","❤快去點贊❤","❤在文章最下面哦❤","❤快去推薦一下吧❤","❤感謝觀看❤","❤");
        var $i = $("<span></span>").text(a[a_idx]);
        a_idx = (a_idx + 1) % a.length;
        var x = e.pageX,
        y = e.pageY;
        $i.css({
            "z-index": 999999999999999999999999999999999999999999999999999999999999999999999,
            "top": y - 20,
            "left": x,
            "position": "absolute",
            "font-weight": "bold",
            "color": "rgb("+~~(255*Math.random())+","+~~(255*Math.random())+","+~~(255*Math.random())+")"
        });
        $("body").append($i);
        $i.animate({
            "top": y - 180,
            "opacity": 0
        },
        1500,
        function() {
            $i.remove();
        });
    });
});
</script>

頁面定製 CSS 程式碼

.git-link {
    z-index: 100;
    position: fixed;
    top: 0;
    right: 0;
    border: 0;
    height: 149px;
    width: 149px;
    transform: rotate(90deg);
    -webkit-transform: rotate(90deg);
    -moz-transform: rotate(90deg);
    -o-transform: rotate(90deg);
    -ms-transform: rotate(90deg);
    background-image: url(//images2015.cnblogs.com/blog/459873/201603/459873-20160317090540131-1089895320.png);
}



/* 文章標題樣式(這個不是markdown裡的標題) */
#topics .postTitle a {
    color: #828282;
    font-size: 36px;
}

/* 普通文字樣式 */
#cnblogs_post_body p {
    margin: 18px auto;
    color: #000;
    font-family: Consolas, "Microsoft YaHei", monospace;
    font-size: 18px;
    text-indent: 0;
}

.cnblogs-markdown code {
  padding: 0;
  padding-top: 0.2em;
  padding-bottom: 0.2em;
  margin: 0;
  font-size: 85%;
  background-color: rgba(0,0,0,0.04);
  border-radius: 3px;
  border: none !important;
  display: inline-block;
}

/* 標題樣式 */
#cnblogs_post_body h1 {
    font-family: Consolas, "Microsoft YaHei", monospace;
    font-size: 32px;
    font-weight: bold;
    line-height: 1.5;
    margin: 10px 0;
}

#cnblogs_post_body h2 {
    font-family: Consolas, "Microsoft YaHei", monospace;
    font-size: 26px;
    font-weight: bold;
    line-height: 1.5;
    margin: 20px 0;
}

#cnblogs_post_body h3 {
    font-family: Consolas, "Microsoft YaHei", monospace;
    font-size: 20px;
    font-weight: bold;
    line-height: 1.5;
    margin: 10px 0;
}

#cnblogs_post_body h4 {
    font-family: Consolas, "Microsoft YaHei", monospace;
    font-size: 18px;
    font-weight: bold;
    margin: 10px 0;
}
/* 標題樣式設定結束 */

/* 去除雙下劃線斜體樣式 */
em {
    font-style: normal;
    color: #000;
}

/* 無序列表 */
#cnblogs_post_body ul li {
    font-family: Consolas, "Microsoft YaHei", monospace;
    color: #000;
    font-size: 16px;
    list-style-type: disc;
}

/* 有序列表 */
#cnblogs_post_body ol li {
    font-family: Consolas, "Microsoft YaHei", monospace;
    color: #000;
    font-size: 16px;
    list-style-type: decimal;
}

/* 超連結 */
#cnblogs_post_body a:link {
    text-decoration: none;
    color: #002C99;
}

/* 引用背景 */
#topics .postBody blockquote {
    background: #f9e9f9;
    border: none;
    margin-bottom: 10px;
    padding: 2px 10px;
    border-left: 5px #CD6839 solid;
}

/* 單行程式碼 */
.cnblogs-markdown code {
    font-family: Consolas, "Microsoft YaHei", monospace !important;
    font-size: 16px!important;
    color: #c7254e;
    line-height: 20px;
    background-color: #f9f2f4!important;
    padding: 0 5px!important;
    border: none;
    line-height: 1.5;
    margin: 1px 5px;
    vertical-align: middle;
    display: inline-block;
}

/* 多行程式碼, 引用 */
.cnblogs-markdown .hljs {
    font-family: Consolas, "Microsoft YaHei", monospace !important;
    font-size: 16px!important;
    background-color: #dfecf0!important;
    line-height: 1.5!important;
    padding: 9px!important;
    border: none;
}

.cnblogs-markdown hr:before {
  display: table;
  content: "";
}

.cnblogs-markdown hr:after {
  display: table;
  clear: both;
  content: "";
}
/* 表格 */
.cnblogs-markdown table {
  border: none;
  width: 100%;
  overflow: auto;
  word-break: normal;
  word-break: keep-all;
  font-family: Consolas, "Microsoft YaHei", monospace !important;
  font-size: 16px!important;
}
/* 表格 表頭 */
.cnblogs-markdown table th {
  font-weight: bold;
}
/* 表格 行,列 */
.cnblogs-markdown table th,
.cnblogs-markdown table td {
  padding: 6px 13px;
  border: none;
}

.cnblogs-markdown table tr {
  background-color: #fff;
  border-top: none;
}

.cnblogs-markdown table tr:nth-child(2n) {
  background-color: #f8f8f8;
}

/*only for syntaxhighlighter */
/*--start--*/
.cnblogs-markdown .syntaxhighlighter table td.code {
  width:95% !important; 
}

.cnblogs-markdown p,
.cnblogs-markdown blockquote,
.cnblogs-markdown ul,
.cnblogs-markdown ol,
.cnblogs-markdown dl,
.cnblogs-markdown table,
.cnblogs-markdown pre {
  margin-top: 0;
  margin-bottom: 16px;
}

部落格側邊欄公告(支援HTML程式碼) (支援 JS 程式碼)

<script language="javascript" type="text/javascript">
function GenerateContentList()
{
    var mainContent = $('#cnblogs_post_body');
    var h2_list = $('#cnblogs_post_body h1');//如果你的章節標題不是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>&nbsp;</p>';
        //content += '<p style="font-size:18px"><b>正文</b></p>';
    }
    if($('#cnblogs_post_body').length != 0 )
    {
        $($('#cnblogs_post_body')[0]).prepend(content);
    }  
}
GenerateContentList();
</script>

<script type="text/javascript" color="0,0,255" opacity='0.7' zIndex="-2" count="99" src="https://files.cnblogs.com/files/lfri/canvas-nest.js"></script>


<script type="text/javascript">
        var a_idx = 0;
        jQuery(document).ready(function($) {
        $("body").click(function(e) {
        var a = new Array("❤喜歡就關注一下吧❤","❤不是點這裡哦❤","❤快去點贊❤","❤在文章最下面哦❤","❤快去推薦一下吧❤","❤感謝觀看❤","❤");
        var $i = $("<span></span>").text(a[a_idx]);
        a_idx = (a_idx + 1) % a.length;
        var x = e.pageX,
        y = e.pageY;
        $i.css({
            "z-index": 999999999999999999999999999999999999999999999999999999999999999999999,
            "top": y - 20,
            "left": x,
            "position": "absolute",
            "font-weight": "bold",
            "color": "rgb("+~~(255*Math.random())+","+~~(255*Math.random())+","+~~(255*Math.random())+")"
        });
        $("body").append($i);
        $i.animate({
            "top": y - 180,
            "opacity": 0
        },
        1500,
        function() {
            $i.remove();
        });
    });
});
</script>

<!-- 雪花 -->

<script type="text/javascript">
   window.onload = function () {
                var minSize = 15; //最小字型
                var maxSize = 30;//最大字型
                var newOne = 600; //生成雪花間隔
                var flakColor = "#1bd3ff"; //雪花顏色
                var flak = $("<div></div>").css({position:"absolute","top":"0px"}).html("❉");//定義一個雪花
                var dhight = $(window).height(); //定義檢視高度
                var dw =$(window).width()-80; //定義檢視寬度
                setInterval(function(){
                var sizeflak = minSize+Math.random()*maxSize; //產生大小不等的雪花
                var startLeft = Math.random()*dw; //雪花生成是隨機的left值
                var startOpacity = 0.7+Math.random()*0.3; //隨機透明度
                var endTop= dhight-100; //雪花停止top的位置
                var endLeft= Math.random()*dw; //雪花停止的left位置
                var durationfull = 5000+Math.random()*3000; //雪花飄落速度不同
                flak.clone().appendTo($("body")).css({
                "left":startLeft ,
                "opacity":startOpacity,
                "font-size":sizeflak,
                "color":flakColor
                }).animate({
                "top":endTop,
                "left":endLeft,
                "apacity":0.1
                },durationfull,function(){
                $(this).remove()
                });
                },newOne);
            }
 </script>


<embed frameborder="no" border="0" marginwidth="0" marginheight="0" width=280 height=86 src="//music.163.com/outchain/player?type=2&id=730631&auto=0&height=66"></embed>

<script charset="Shift_JIS" src="http://chabudai.sakura.ne.jp/blogparts/honehoneclock/honehone_clock_tr.js">
</script>

<a class="git-link" href="https://github.com/kangyujian"></a>

頁首 HTML 程式碼

<!-- 右下角live2d效果 -->
<script type="text/javascript" charset="utf-8" async="" src="https://cdn.jsdelivr.net/npm/[email protected]/lib/L2Dwidget.min.js"></script>

頁尾 HTML 程式碼

<!-- 右下角live2d效果 -->
<script type="text/javascript">
setTimeout(() => {
        L2Dwidget.init({
                "model": {
                        "scale": 0.5
                },
                "display": {
                        "position": "right",
                        "width": 180,
                        "height": 260,
                        "hOffset": 0,
                        "vOffset": -20
                },
                "mobile": {
                        "show": true,
                        "scale": 0.5
                },
                "react": {
                        "opacityDefault": 0.7,
                        "opacityOnHover": 0.2
                }
        });
}, 1000)
</script>