当前位置:

JS特效函数汇总

本文最后更新于2020-04-28,已超过 1年没有更新,如果文章内容、图片或者下载资源失效,请留言反馈,我会及时处理,谢谢!

温馨提示:本文共2615个字,读完预计7分钟。

<script type="text/javascript">
    //~ heart 点击显示心形
    ! function(c, d, g) {
        function f() {
            for(var a = 0; a < b.length; a++)
                0 >= b[a].alpha ? (d.body.removeChild(b[a].el), b.splice(a, 1)) : (b[a].y–, b[a].scale += .004, b[a].alpha -= .013, b[a].el.style.cssText = “left:” + b[a].x + “px;top:” + b[a].y + “px;opacity:” + b[a].alpha + “;transform:scale(” + b[a].scale + “,” + b[a].scale + “) rotate(45deg);background:” + b[a].color + ";z-index:99999");
            requestAnimationFrame(f)
        }
        var b = [];
        c.requestAnimationFrame = c.requestAnimationFrame || c.webkitRequestAnimationFrame || c.mozRequestAnimationFrame || c.oRequestAnimationFrame ||
            c.msRequestAnimationFrame || function(a) { setTimeout(a, 1E3 / 60) };
        (function(a) { var b = d.createElement("style");
            b.type = "text/css"; try { b.appendChild(d.createTextNode(a)) } catch(e) { b.styleSheet.cssText = a } d.getElementsByTagName("head")[0].appendChild(b) })(".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;}");
        (function() { var a = "function" == typeof c.onclick && c.onclick;
            c.onclick = function(c) { a && a(); var e = d.createElement("div");
                e.className = "heart";
                b.push({ el: e, x: c.clientX – 5, y: c.clientY – 5, scale: 1, alpha: 1, color: "rgb(" + ~~(255 * Math.random()) + "," + ~~(255 * Math.random()) + "," + ~~(255 * Math.random()) + ")" });
                d.body.appendChild(e) } })();
        f()
    }(window, document);
    //~ copy  复制追加版权
    var Sys = {};
    var ua = navigator.userAgent.toLowerCase();
    if(window.ActiveXObject) { document.body.oncopy = function() { event.returnValue = false; var t = document.selection.createRange().text; var s = "<br/><br/>本文出自[Mr.Li’s Blog]<br/>转载请保留来源链接:" + location.href;
            clipboardData.setData('Text', t + '\r\n' + s); } } else {
        function addLink() { var body_element = document.getElementsByTagName('body')[0]; var selection;
            selection = window.getSelection(); var pagelink = " <br/><br/>本文出自[Mr.Li’s Blog] <br/>转载请保留来源链接:" + document.location.href; var copytext = selection + pagelink; var newdiv = document.createElement('div');
            newdiv.style.position = 'absolute';
            newdiv.style.left = '-99999px';
            body_element.appendChild(newdiv);
            newdiv.innerHTML = copytext;
            selection.selectAllChildren(newdiv);
            window.setTimeout(function() { body_element.removeChild(newdiv); }, 0); } document.oncopy = addLink; }
</script>

本文链接:,转发请注明来源!
评论已关闭。