博客网站美化技术

401人浏览 / 0人评论
  • 修改鼠标样式
<style type="text/css">
html{cursor: url("http://ued.taobao.com/blog/wp-content/themes/taobaoued/images/cursor.ico"),auto;}
</style>  
  • 页面引用动漫小人物
<!-- 右下角live2d效果 -->
<script src="https://eqcn.ajz.miesnfu.com/wp-content/plugins/wp-3d-pony/live2dw/lib/L2Dwidget.min.js"></script>
<script>
L2Dwidget.init({ "model": { jsonPath:
"https://unpkg.com/live2d-widget-model-shizuku@1.0.5/assets/shizuku.model.json",
"scale": 1 }, "display": { "position": "right", "width": 150, "height": 300,
"hOffset": 0, "vOffset": -20 }, "mobile": { "show": true, "scale": 0.5 },
"react": { "opacityDefault": 0.7, "opacityOnHover": 0.2 } });
</script>
<!-- 
jsonPath:动漫人员模版地址
小帅哥: https://unpkg.com/live2d-widget-model-chitose@1.0.5/assets/chitose.model.json
萌娘:https://unpkg.com/live2d-widget-model-shizuku@1.0.5/assets/shizuku.model.json 
小可爱(女):https://unpkg.com/live2d-widget-model-koharu@1.0.5/assets/koharu.model.json 
小可爱(男):https://unpkg.com/live2d-widget-model-haruto@1.0.5/assets/haruto.model.json
初音:https://unpkg.com/live2d-widget-model-miku@1.0.5/assets/miku.model.json
-->

 

  •     鼠标拖尾特效
<script type="text/javascript">
    !function () {
        function o(w, v, i) {
            return w.getAttribute(v) || i
        }

        function j(i) {
            return document.getElementsByTagName(i)
        }

        function l() {
            var i = j("script"),
                w = i.length,
                v = i[w - 1];
            return {
                l: w,
                z: o(v, "zIndex", -1),
                o: o(v, "opacity", 0.5),
                c: o(v, "color", "0,0,0"),
                n: o(v, "count", 99)
            }
        }

        function k() {
            r = u.width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth,
                n = u.height = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight
        }

        function b() {
            e.clearRect(0, 0, r, n);
            var w = [f].concat(t);
            var x, v, A, B, z, y;
            t.forEach(function (i) {
                i.x += i.xa,
                    i.y += i.ya,
                    i.xa *= i.x > r || i.x < 0 ? -1 : 1,
                    i.ya *= i.y > n || i.y < 0 ? -1 : 1,
                    e.fillRect(i.x - 0.5, i.y - 0.5, 1, 1);
                for (v = 0; v < w.length; v++) {
                    x = w[v];
                    if (i !== x && null !== x.x && null !== x.y) {
                        B = i.x - x.x,
                            z = i.y - x.y,
                            y = B * B + z * z;
                        y < x.max && (x === f && y >= x.max / 2 && (i.x -= 0.03 * B, i.y -= 0.03 * z), A = (x.max - y) / x.max, e.beginPath(), e.lineWidth = A / 2, e.strokeStyle = "rgba(" + s.c + "," + (A + 0.2) + ")", e.moveTo(i.x, i.y), e.lineTo(x.x, x.y), e.stroke())
                    }
                }
                w.splice(w.indexOf(i), 1)
            }),
                m(b)
        }

        var u = document.createElement("canvas"),
            s = l(),
            c = "c_n" + s.l,
            e = u.getContext("2d"),
            r,
            n,
            m = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame ||
                function (i) {
                    window.setTimeout(i, 1000 / 45)
                },
            a = Math.random,
            f = {
                x: null,
                y: null,
                max: 20000
            };
        u.id = c;
        u.style.cssText = "position:fixed;top:0;left:0;z-index:" + s.z + ";opacity:" + s.o;
        j("body")[0].appendChild(u);
        k(),
            window.onresize = k;
        window.onmousemove = function (i) {
            i = i || window.event,
                f.x = i.clientX,
                f.y = i.clientY
        },
            window.onmouseout = function () {
                f.x = null,
                    f.y = null
            };
        for (var t = [], p = 0; s.n > p; p++) {
            var h = a() * r,
                g = a() * n,
                q = 2 * a() - 1,
                d = 2 * a() - 1;
            t.push({
                x: h,
                y: g,
                xa: q,
                ya: d,
                max: 6000
            })
        }
        setTimeout(function () {
            b()
        }, 100)
    }();
</script>
  • 添加我的备案号  
<!--备案号 只是做个记录-->
 Copyright © 2019 mfshi.com All Rights Reserved | <a href="http://www.beian.gov.cn/">粤ICP备19097677号-1</a> 魔法实验个人技术站
<!--备案号 -->
  •  鼠标点击爱心效果
<script type="text/javascript">
        /*7Core-CN - 网页鼠标点击特效(爱心)*/
        !function (e, t, a) {function r() {for (var e = 0; e < s.length; e++) s[e].alpha <= 0 ? (t.body.removeChild(s[e].el), s.splice(e, 1)) : (s[e].y--, s[e].scale += .004, s[e].alpha -= .013, s[e].el.style.cssText = "left:" + s[e].x + "px;top:" + s[e].y + "px;opacity:" + s[e].alpha + ";transform:scale(" + s[e].scale + "," + s[e].scale + ") rotate(45deg);background:" + s[e].color + ";z-index:99999");requestAnimationFrame(r)}function n() {var t = "function" == typeof e.onclick && e.onclick;e.onclick = function (e) {t && t(), o(e)}}function o(e) {var a = t.createElement("div");a.className = "heart", s.push({el: a,x: e.clientX - 5,y: e.clientY - 5,scale: 1,alpha: 1,color: c()}), t.body.appendChild(a)}function i(e) {var a = t.createElement("style");a.type = "text/css";try {a.appendChild(t.createTextNode(e))} catch (t) {a.styleSheet.cssText = e}t.getElementsByTagName("head")[0].appendChild(a)}function c() {return "rgb(" + ~~(255 * Math.random()) + "," + ~~(255 * Math.random()) + "," + ~~(255 * Math.random()) + ")"}var s = [];e.requestAnimationFrame = e.requestAnimationFrame || e.webkitRequestAnimationFrame || e.mozRequestAnimationFrame || e.oRequestAnimationFrame || e.msRequestAnimationFrame || function (e) {setTimeout(e, 1e3 / 60)}, i(".heart{width: 10px;height: 10px;position: fixed;background: #f00;transform: rotate(45deg);-webkit-transform: rotate(45deg);-moz-transform: rotate(45deg);}.heart:after,.heart:before{content: '';width: inherit;height: inherit;background: inherit;border-radius: 50%;-webkit-border-radius: 50%;-moz-border-radius: 50%;position: fixed;}.heart:after{top: -5px;}.heart:before{left: -5px;}"), n(), r()}(window, document);
</script>
  • 添加网站图标
<link rel="shortcut icon" href="/attachment/20191021/961154a4e7dd4d95863e80aedc73a450.ico" />
<link rel="bookmark"href="/attachment/20191021/961154a4e7dd4d95863e80aedc73a450.ico" />
  • 注意事项
  1. 一般网站引用其他域名资源会有跨域问题。本网站使用Jpress开源技术,使用的是Jfinal前端模版,所以需要在拦截器加controller.getResponse().setHeader("Access-Control-Allow-Origin", "*"); 这一行代码,表示支持跨域请求。
public class JPressInterceptor implements Interceptor {

    public static final String ADDON_PATH_KEY = "APATH";
    private static final String ADDON_PATH_VALUE = "";

    public void intercept(Invocation inv) {
        Controller controller = inv.getController();
        //自定义代码 跨域支持
        controller.getResponse().setHeader("Access-Control-Allow-Origin", "*");
        //方便模板开发者直接在模板里接收参数
        controller.setAttr("C", controller);
        controller.setAttr(ADDON_PATH_KEY, ADDON_PATH_VALUE);
        inv.invoke();
    }
    
}

 

支付宝扫码打赏 微信打赏

如果文章对您有帮助,欢迎移至上方按钮打赏,非常感谢你的支持!

全部评论