zoukankan      html  css  js  c++  java
  • 派大星博客的美化之路

    主题

    SimpleMemory

    更改背景颜色、标题、子标题

    #blogTitle h1 a {
        color: #515151;
    background: #EEE url(data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAIAAAAmkwkpAAAAHklEQVQImWNkYGBgYGD4//8/A5wF5SBYyAr+//8PAPOCFO0Q2zq7AAAAAElFTkSuQmCC) repeat;
    text-shadow: 5px -5px black, 4px -4px white;
    font-weight: bold;
    -webkit-text-fill-color: transparent;
    -webkit-background-clip: text }
    .vintage2{
    color: transparent;
    -webkit-text-stroke: 1px red;
    letter-spacing: 0.04em;}
    .vintage3 {
    color: transparent;
    background-color : blue;
    text-shadow : rgba(255,255,255,0.5) 0 5px 6px, rgba(255,255,255,0.2) 1px 3px 3px;
    -webkit-background-clip : text;
    
    }
    #blogTitle h2 {
        left: auto;
        font-weight: normal;
        font-size: 13px;
        font-size: 0.928571429rem;
        line-height: 1.846153846;
        color: #258ce4;
        float: left;
        padding-left: 150px;
        font-family: monospace;
        animation: change 8s linear 0s infinite;
    }
    @keyframes change{0% {
        color: #1f58dc;
    }
    
    10% {
        color: #9ab2ea;
    }
    20% {
        color: #ff0;
    }
    30% {
        color: #666d55;
    }
    40% {
        color: #1f58dc;
    }
    50% {
        color: #ad4d0d;
    }
    60% {
        color: #3360ca;
    }
    70% {
        color: #108883;
    }
    80% {
        color: #238434;
    }
    90% {
        color: #b0e418;
    }
    100% {
        color: #d09292;
    }}
     body  {
            background: #c1d8d2;
        }

    添加下雪效果

    <script type="text/javascript">
        /* 控制下雪 */
        function snowFall(snow) {
            /* 可配置属性 */
            snow = snow || {};
            this.maxFlake = snow.maxFlake || 200;   /* 最多片数 */
            this.flakeSize = snow.flakeSize || 10;  /* 雪花形状 */
            this.fallSpeed = snow.fallSpeed || 1;   /* 坠落速度 */
        }
        /* 兼容写法 */
        requestAnimationFrame = window.requestAnimationFrame ||
            window.mozRequestAnimationFrame ||
            window.webkitRequestAnimationFrame ||
            window.msRequestAnimationFrame ||
            window.oRequestAnimationFrame ||
            function(callback) { setTimeout(callback, 1000 / 60); };
     
        cancelAnimationFrame = window.cancelAnimationFrame ||
            window.mozCancelAnimationFrame ||
            window.webkitCancelAnimationFrame ||
            window.msCancelAnimationFrame ||
            window.oCancelAnimationFrame;
        /* 开始下雪 */
        snowFall.prototype.start = function(){
            /* 创建画布 */
            snowCanvas.apply(this);
            /* 创建雪花形状 */
            createFlakes.apply(this);
            /* 画雪 */
            drawSnow.apply(this)
        }
        /* 创建画布 */
        function snowCanvas() {
            /* 添加Dom结点 */
            var snowcanvas = document.createElement("canvas");
            snowcanvas.id = "snowfall";
            snowcanvas.width = window.innerWidth;
            snowcanvas.height = document.body.clientHeight;
            snowcanvas.setAttribute("style", "position:absolute; top: 0; left: 0; z-index: 1; pointer-events: none;");
            document.getElementsByTagName("body")[0].appendChild(snowcanvas);
            this.canvas = snowcanvas;
            this.ctx = snowcanvas.getContext("2d");
            /* 窗口大小改变的处理 */
            window.onresize = function() {
                snowcanvas.width = window.innerWidth;
                /* snowcanvas.height = window.innerHeight */
            }
        }
        /* 雪运动对象 */
        function flakeMove(canvasWidth, canvasHeight, flakeSize, fallSpeed) {
            this.x = Math.floor(Math.random() * canvasWidth);   /* x坐标 */
            this.y = Math.floor(Math.random() * canvasHeight);  /* y坐标 */
            this.size = Math.random() * flakeSize + 2;          /* 形状 */
            this.maxSize = flakeSize;                           /* 最大形状 */
            this.speed = Math.random() * 1 + fallSpeed;         /* 坠落速度 */
            this.fallSpeed = fallSpeed;                         /* 坠落速度 */
            this.velY = this.speed;                             /* Y方向速度 */
            this.velX = 0;                                      /* X方向速度 */
            this.stepSize = Math.random() / 30;                 /* 步长 */
            this.step = 0                                       /* 步数 */
        }
        flakeMove.prototype.update = function() {
            var x = this.x,
                y = this.y;
            /* 左右摆动(余弦) */
            this.velX *= 0.98;
            if (this.velY <= this.speed) {
                this.velY = this.speed
            }
            this.velX += Math.cos(this.step += .05) * this.stepSize;
     
            this.y += this.velY;
            this.x += this.velX;
            /* 飞出边界的处理 */
            if (this.x >= canvas.width || this.x <= 0 || this.y >= canvas.height || this.y <= 0) {
                this.reset(canvas.width, canvas.height)
            }
        };
        /* 飞出边界-放置最顶端继续坠落 */
        flakeMove.prototype.reset = function(width, height) {
            this.x = Math.floor(Math.random() * width);
            this.y = 0;
            this.size = Math.random() * this.maxSize + 2;
            this.speed = Math.random() * 1 + this.fallSpeed;
            this.velY = this.speed;
            this.velX = 0;
        };
        // 渲染雪花-随机形状(此处可修改雪花颜色!!!)
        flakeMove.prototype.render = function(ctx) {
            var snowFlake = ctx.createRadialGradient(this.x, this.y, 0, this.x, this.y, this.size);
            snowFlake.addColorStop(0, "rgba(255, 255, 255, 0.9)");  /* 此处是雪花颜色,默认是白色 */
            snowFlake.addColorStop(.5, "rgba(255, 255, 255, 0.5)"); /* 若要改为其他颜色,请自行查 */
            snowFlake.addColorStop(1, "rgba(255, 255, 255, 0)");    /* 找16进制的RGB 颜色代码。 */
            ctx.save();
            ctx.fillStyle = snowFlake;
            ctx.beginPath();
            ctx.arc(this.x, this.y, this.size, 0, Math.PI * 2);
            ctx.fill();
            ctx.restore();
        };
        /* 创建雪花-定义形状 */
        function createFlakes() {
            var maxFlake = this.maxFlake,
                flakes = this.flakes = [],
                canvas = this.canvas;
            for (var i = 0; i < maxFlake; i++) {
                flakes.push(new flakeMove(canvas.width, canvas.height, this.flakeSize, this.fallSpeed))
            }
        }
        /* 画雪 */
        function drawSnow() {
            var maxFlake = this.maxFlake,
                flakes = this.flakes;
            ctx = this.ctx, canvas = this.canvas, that = this;
            /* 清空雪花 */
            ctx.clearRect(0, 0, canvas.width, canvas.height);
            for (var e = 0; e < maxFlake; e++) {
                flakes[e].update();
                flakes[e].render(ctx);
            }
            /*  一帧一帧的画 */
            this.loop = requestAnimationFrame(function() {
                drawSnow.apply(that);
            });
        }
        /* 调用及控制方法 */
        var snow = new snowFall({maxFlake:500});
        snow.start();
    </script>

    添加天气

     --心知天气网页插件--

    https://www.seniverse.com/widget/create

     添加目录

    --可以直接插在页脚HTML代码--

    <div id="div_digg1" align="center"><p id="bfq"  ></p></div>
    <style>
    * {
        margin: 0;
        padding: 0;
        border: 0;
    }
    #div_digg1 {
        padding: 5px;
        position: fixed;
        _position: absolute;
        z-index: 1000;
        bottom: 10px;
        left:10px;
        _left: 15px;
        border: 0;
    }
    #back-top {
         position: fixed;
         bottom: 10px;
         right: 80px;
         z-index: 99;
    }
    #back-top span {
          50px;
         height: 64px;
         display: block;
         background:url(http://images.cnblogs.com/cnblogs_com/seanshao/855033/o_rocket.png) no-repeat center center;
    }
    #back-top a{outline:none}
    </style>
    <script type="text/javascript">
    $(function() {
        // hide #back-top first
        $("#back-top").hide();
        // fade in #back-top
        $(window).scroll(function() {
            if ($(this).scrollTop() > 500) {
                $('#back-top').fadeIn();
            } else {
                $('#back-top').fadeOut();
            }
        });
        // scroll body to 0px on click
        $('#back-top a').click(function() {
            $('body,html').animate({
                scrollTop: 0
            }, 800);
            return false;
        });
    });
    </script>
    <p id="back-top" style="display:none"><a href="#top"><span></span></a></p>
    <div class="fixedIndexs" style="position: fixed;bottom: 40px;display: none"></div>
    <script language="javascript" type="text/javascript">
        var fixedIndexs=$('.fixedIndexs');
        var hs = $('#cnblogs_post_body h2');
        function openorclose(a) {
            $("#indexs").slideToggle("fast");
            var text=$(a).text();
            if(text=='[-]'){
                $(a).text("[+]");
                return;
            }
            $(a).text("[-]");
        }
        function createIndexs(){
            var indexs_container=$('<div style="border:solid 1px #ccc; background:#eee;180px;padding:4px 10px;"></div>');
            var indexs_controller=$('<p style="text-align:right;margin:0;"><span style="float:left;">目录<a onclick="javascript:openorclose(this);" style="cursor: pointer">[-]</a></span><a href="#top" style="text-align: right;color: #444">返回顶部</a></p>');
            var indexs=$('<ol id="indexs" style="margin-left: 14px; padding-left: 14px; line-height: 160%; display: block;"></ol>');
            indexs_container.append(indexs_controller).append(indexs);
            $.each(hs,function(i,h){
                $(h).before('<a name="index_'+i+'"></a>');
                indexs.append('<li style="list-style:decimal"><a href="#index_'+i+'" id="active_'+i+'">'+$(h).text()+'</a></li>');
            });
            if(hs.length!=0){
                fixedIndexs.append(indexs_container);
                //get home div right offset
                fixedIndexs.css('right',$("#home").offset().left+32+'px');
            }
        }
        createIndexs();
        $(window).scroll(function(event){
            //clear all active
            $("#indexs li a").removeClass("active");
            //set active
            $.each(hs,function (i, h) {
                var next_active_top;
                i<(hs.length-1)?next_active_top=hs.eq(i+1).offset().top:hs.last().offset().top;
                if($(h).offset().top<$(window).scrollTop()+30&&$(window).scrollTop()+30<next_active_top){
                    $("#active_"+i).addClass("active");
                }
                if(i+1==hs.length&&$(window).scrollTop()+30>hs.last().offset().top){
                    $("#active_"+i).addClass("active");
                }
            });
            //auto display
            if($(window).scrollTop()>$(window).height()){
                fixedIndexs.show();
                return;
            }
            fixedIndexs.hide();
        });
        $(window).resize(function (event) {
            fixedIndexs.hide();
            fixedIndexs.css('right',$("#home").offset().left+32+'px');
            if($(window).scrollTop()>$(window).height()){
                fixedIndexs.show();
            }
        })
    </script>
  • 相关阅读:
    Adb connect监听指定的主机和端口/Adb监听Visual Studio Emulator for Android模拟器
    Adb工具常用操作-转(二)
    Adb工具常用操作(一)
    Android手机开发者模式设置
    C#生成验证码实例
    vs中debug和release版本的区别(转)
    HTML5 Canvas实现刮刮卡效果实例
    HTML5 canvas createRadialGradient()放射状/圆形渐变
    Axure RP 8.0正式版下载地址 安装和汉化说明
    CSS的clip-path(转)
  • 原文地址:https://www.cnblogs.com/zldqpm/p/10184380.html
Copyright © 2011-2022 走看看