博客园个性化样式设置(二)

前言:前面一篇文章已经介绍了博客园JS权限的获取,如果有同学还不知道的话。可以前往查看。

传送门https://www.cnblogs.com/jc-home/p/12132076.html


 

一、设置公告栏与头像

在【博客侧边栏公告】加入

<center> <img src="https://images.cnblogs.com/cnblogs_com/jc-home/1620995/o_191226034713xiaoxin.jpg" alt="Jc的头像" class="img_avatar" width=170px" style="border-radius:70%">
</center>

 


 二、设置鼠标移动标题动画效果

在【页面定制css代码】加入

/* 文章title自定义带动画样式,鼠标移动标题变化 */
.postTitle {
  font-family: "Lato", Helvetica Neue, Helvetica, Arial, sans-serif;
  clear: both;
  background-color: #FBF9F9;
  margin-bottom: 8px;
  padding-top: 5px;
  padding-bottom: 5px;
  margin-top: 20px;
  border-left: 3px solid #21759b;
  padding-left: 20px;
  font-size: 20px;
  border-radius:0px;
}
.postTitle a:hover {
  text-decoration: none;
  margin-left: 20px;
  color: #E00000;
}
.postTitle a:link,
.postTitle a:visited,
.postTitle a:active {
  transition: all 0.4s linear 0s;
}

 效果

 


 

三、增加点赞按钮

在【页面定制css代码】加入

/* 阅读增加点赞按钮 */
#div_digg{
  padding: 5px;
  border-radius: 5px;
  position: fixed;
  left: 40px;
  bottom: 80px;
  width:80px;
  z-index:100;
}
.diggit{
  background: url(http://images2017.cnblogs.com/blog/894443/201709/894443-20170920105433618-867225449.png) no-repeat;
  width: 60px;
  height: 60px;
  left: 40px;
}
#div_digg .diggnum{
  position: absolute;
  bottom: -20px;
  left: 6px;
  background: #D0D0D0;
  padding: 2px 0;
  display: block;
  color: #555;
  font-size: 12px;
  text-align: center;
  width: 60px;
  -moz-border-radius: 4px;
  -webkit-border-radius: 4px;
  font-weight: bold;
}
/* 删除反对按钮,有点邪恶了 */
.buryit{
  display: none;
}

 效果:

 


 

四、去掉广告

在【页面定制css代码】加入

/* 去掉广告 */
#ad_t2,#opt_under_post,.c_ad_block,#under_post_news,#under_post_kb{
    display: none !important;
}
/*********

 


 

五、鼠标点击爆星特性

在【页脚html代码】加入

<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 src="https://files.cnblogs.com/files/wkfvawl/mouse-click.js"></script>
<canvas width="1777" height="841" style="position: fixed; left: 0px; top: 0px; z-index: 2147483647; pointer-events: none;"></canvas>

 效果:

 


 

六、鼠标点击线段连接

在【页脚html代码】加入

<!--代码放置于</body>上方-->

<script>

!function(){

function n(n,e,t){

return n.getAttribute(e)||t

}

function e(n){

return document.getElementsByTagName(n)

}

function t(){

var t=e("script"),o=t.length,i=t[o-1];

return{

l:o,z:n(i,"zIndex",-1),o:n(i,"opacity",.5),c:n(i,"color","0,0,0"),n:n(i,"count",99)

}

}

function o(){

a=m.width=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,

c=m.height=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight

}

function i(){

r.clearRect(0,0,a,c);

var n,e,t,o,m,l;

s.forEach(function(i,x){

for(i.x+=i.xa,i.y+=i.ya,i.xa*=i.x>a||i.x<0?-1:1,i.ya*=i.y>c||i.y<0?-1:1,r.fillRect(i.x-.5,i.y-.5,1,1),e=x+1;e<u.length;e++)n=u[e],

null!==n.x&&null!==n.y&&(o=i.x-n.x,m=i.y-n.y,

l=o*o+m*m,l<n.max&&(n===y&&l>=n.max/2&&(i.x-=.03*o,i.y-=.03*m),

t=(n.max-l)/n.max,r.beginPath(),r.lineWidth=t/2,r.strokeStyle="rgba("+d.c+","+(t+.2)+")",r.moveTo(i.x,i.y),r.lineTo(n.x,n.y),r.stroke()))

}),

x(i)

}

var a,c,u,m=document.createElement("canvas"),

d=t(),l="c_n"+d.l,r=m.getContext("2d"),

x=window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||

function(n){

window.setTimeout(n,1e3/45)

},

w=Math.random,y={x:null,y:null,max:2e4};m.id=l,m.style.cssText="position:fixed;top:0;left:0;z-index:"+d.z+";opacity:"+d.o,e("body")[0].appendChild(m),o(),window.onresize=o,

window.onmousemove=function(n){

n=n||window.event,y.x=n.clientX,y.y=n.clientY

},

window.onmouseout=function(){

y.x=null,y.y=null

};

for(var s=[],f=0;d.n>f;f++){

var h=w()*a,g=w()*c,v=2*w()-1,p=2*w()-1;s.push({x:h,y:g,xa:v,ya:p,max:6e3})

}

u=s.concat([y]),

setTimeout(function(){i()},100)

}();
</script>
View Code

效果:

 


 

七、火箭加速置顶动画

在【页脚html代码】加入

  <!-- 小火箭-->
<script src="https://blog-static.cnblogs.com/files/pythonywy/jQuery1.7.js"></script>
<style type="text/css">
 
    /*回到顶部*/
    #rocket-to-top div {
        left: 0;
        margin: 0;
        overflow: hidden;
        padding: 0;
        position: absolute;
        top: 0;
        width: 149px;
    }
 
    #rocket-to-top .level-2 {
        background: url("https://images.cnblogs.com/cnblogs_com/pythonywy/1455951/o_redhuojian2.png") no-repeat scroll -149px 0 transparent;
        display: none;
        height: 250px;
        opacity: 0;
        z-index: 1;
    }
 
    #rocket-to-top .level-3 {
        background: none repeat scroll 0 0 transparent;
        display: block;
        height: 150px;
        z-index: 2;
    }
 
    #rocket-to-top .level-3:hover {
        cursor: url(https://images.cnblogs.com/cnblogs_com/pythonywy/1516412/o_huo3.png), auto;
    }
 
    #rocket-to-top .level-3:active {
        cursor: url(https://images.cnblogs.com/cnblogs_com/pythonywy/1516412/o_huo1.png), auto;
    }
 
    #rocket-to-top .level-3:focus {
        cursor: url(https://images.cnblogs.com/cnblogs_com/pythonywy/1516412/o_huo2.png), auto;
    }
 
    #rocket-to-top {
        background: url("https://images.cnblogs.com/cnblogs_com/pythonywy/1455951/o_redhuojian2.png") no-repeat scroll 0 0 transparent;
        cursor: default;
        display: block;
        height: 250px;
        margin: -125px 0 0;
        overflow: hidden;
        padding: 0;
        position: fixed;
        right: 10px;
        top: 90%;
        width: 149px;
        z-index: 11;
    }
</style>
<div style="display: none;" id="rocket-to-top">
    <div style="opacity:0;display: block;" class="level-2"></div>
    <div class="level-3"></div>
</div>
<script>
    $(function () {
        var e = $("#rocket-to-top"),
            t = $(document).scrollTop(),
            n,
            r,
            i = !0;
        $(window).scroll(function () {
            var t = $(document).scrollTop();
            t == 0 ? e.css("background-position") == "0px 0px" ? e.fadeOut("slow") : i && (i = !1, $(".level-2").css("opacity", 1), e.delay(100).animate({
                    marginTop: "-1000px"
                },
                "normal",
                function () {
                    e.css({
                        "margin-top": "-125px",
                        display: "none"
                    }),
                        i = !0
                })) : e.fadeIn("slow")
        }),
            e.hover(function () {
                    $(".level-2").stop(!0).animate({
                        opacity: 1
                    })
                },
                function () {
                    $(".level-2").stop(!0).animate({
                        opacity: 0
                    })
                }),
            $(".level-3").click(function () {
                function t() {
                    var t = e.css("background-position");
                    if (e.css("display") == "none" || i == 0) {
                        clearInterval(n),
                            e.css("background-position", "0px 0px");
                        e.css("cursor", "url(https://images.cnblogs.com/cnblogs_com/pythonywy/1516412/o_huo1.png), auto");
                        return
                    }
                    switch (t) {
                        case "0px 0px":
                            e.css("background-position", "-298px 0px");
                            break;
                        case "-298px 0px":
                            e.css("background-position", "-447px 0px");
                            break;
                        case "-447px 0px":
                            e.css("background-position", "-596px 0px");
                            break;
                        case "-596px 0px":
                            e.css("background-position", "-745px 0px");
                            break;
                        case "-745px 0px":
                            e.css("background-position", "-298px 0px");
                    }
                }
                if (!i) return;
                n = setInterval(t, 50),
                    $("html,body").animate({scrollTop: 0}, "slow");
            });
    });
</script>
View Code

效果:

   

posted @ 2020-01-02 13:52  Jc_code  阅读(418)  评论(0编辑  收藏  举报