开源中国愚人节网页变模糊的js blur代码
- <![if !IE]>
- <script>
- /*
- * by moli
- */
- $(document).ready(function(){
- if(document.cookie.indexOf("lu=") == -1 ){
- // 延时2秒
- setTimeout("jQuery.mxblur.interID = setInterval('jQuery.mxblur.begin()', 5)", 1500);
- }
- });
- $.mxblur = {
- interID : null,
- num: 0.01,
- begin : function() {
- jQuery.mxblur.blur( jQuery.mxblur.num );
- if(jQuery.mxblur.num > 3) {
- jQuery.mxblur.num = 0;
- if(confirm("少年!是不是代码写多了?眼睛模糊了?")) {
- alert("太累啦,就该歇歇啦,愚人节快乐:)");
- clearInterval(jQuery.mxblur.interID );
- jQuery.mxblur.blur(0);
- document.cookie = "lu=lu";
- }
- }
- jQuery.mxblur.num = jQuery.mxblur.num + 1 /100;
- },
- blur : function() {
- $("body").css("-webkit-filter","blur("+$.mxblur.num+"px)");
- $("body").css("-moz-filter","blur("+$.mxblur.num+"px)");
- $("body").css("-o-filter","blur("+$.mxblur.num+"px)");
- $("body").css("-ms-filter","blur("+$.mxblur.num+"px)");
- $("body").css("filter","blur("+$.mxblur.num+"px)");
- $("body").css("filter","url(blur.svg#"+ $.mxblur.num.toFixed(1) +")");
- }
- }
- </script>
- <![endif]>
14年愚人节打开OSCHINA,然后等了2秒钟,你会发现网页全变模糊了,刚以为是浏览器问题,然后看了网页源码。就是加了一段代码就能实现。呵呵 分享给大家