到处闲逛时经常能发现一些有趣的代码段,于是干脆来个大杂烩吧~
狡猾的标题栏
这个效果很多博客都使用了,看gif图:
很有趣是不是?实现的代码也很简单,在网页的任意地方加入即可:
- <script>
- // 浏览器标题切换
- var OriginTitile = document.title; // 保存之前页面标题
- var titleTime;
- document.addEventListener('visibilitychange', function(){
- if (document.hidden){
- document.title = '草榴社區主論壇 - 1024';
- clearTimeout(titleTime);
- }else{
- document.title = '生命-1s ~ ';
- titleTime = setTimeout(function() {
- document.title = OriginTitile;
- }, 2000); // 2秒后恢复原标题
- }
- });
- </script>
飘荡在页面左下角的蒲公英
这个也可以说是烂大街了……具体效果可以直接看本页面的左下角……
实现代码如下:
- <div class="dandelion">
- <span class="smalldan"></span>
- <span class="bigdan"></span>
- </div>
- <style type="text/css">
- /* 在小屏幕自动隐藏 */
- @media screen and (max-width:600px){
- .dandelion{display: none !important;}
- }
- .dandelion span {
- display: block;
- position: fixed;
- z-index: 9999999999;
- bottom: 0px;
- background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJYAAACWCAYAAAA8AXHiAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAHoFJREFUeNrsnQuYTdXfx9c5M+/zPk8YTF4iElFuFf0Z16Tw/t2KbhLpgm7EH7lEVCRJQkpUIolC+burRLnH5NLNkHvutwYzep+XmXPe/Ws+693L6cwMMvuMM+v3POs5M+fss/c5e3339/f9fdfa6/iCwaCyYeNSh9+eAhsWWDYssGxYYNmwYYFlwwLLhgWWDRsWWDYssGxYYNmwYYFlwwLLhgWWDRsWWDYssGxYYNmwYYFlwwLLhgWWDRsWWDYssGxYYNmwYYFlwwLLhgWWDRsWWDYssGxYYNmwYYFlwwLLhgWWDRsWWDYssGxYYNmwcRERm9e+8PwBt+W1r3yD04477ZhXB2wxZJllrCgCz6xMXmvrtBlso6OI0x6xjGUjNGo7bY3xf1OnnUTaBEKkzgmnzXPaNqfd6bR4p13ptOQw21uNlYdD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yFrPhSwlWFEongk6TKnQ8YUy4VcSRZc3vSvVOSJyuOpSl517jEe421f5y2B50XIkEKCOndBVstaORstDI0bjFZghTKWrQy9698dyuPJlV4CS24hq2aB5Wnf3sLfydHMWCdtX3tuNehxwjXRrLEkz9ey2srT0D8nZ65kE3XA2h5hfZfX0qAwlswq2RTtVaFEAWVv/fIyTHM0asW7NUm9C33xyuC//FTyGa8/wP8JMABR206VKCmUlQAAAABJRU5ErkJggi8qICB8eEd2MDB8MzlmM2RlNzNmMjA4YTA0MTlkMTg4N2VmNjIxZGQ3YTQgKi8=);
- background-repeat: no-repeat;
- _background: none;
- /* 动画效果 */
- -webkit-animation: ball-x 3s linear 2s infinite;
- -moz-animation: ball-x 3s linear 2s infinite;
- animation: ball-x 3s linear 2s infinite;
- -webkit-transform-origin: bottom center;
- -moz-transform-origin: bottom center;
- transform-origin: bottom center;
- }
- /* 大的蒲公英样式 */
- .dandelion .bigdan {
- width: 64px;
- height: 115px;
- left: 41px;
- background-position: -86px -36px;
- border: 0px solid #fff;
- }
- /* 小的蒲公英样式 */
- .dandelion .smalldan {
- width: 36px;
- height: 60px;
- left: 88px;
- background-position: 0 -90px;
- border: 0px solid #fff;
- }
- /* 以下是动画效果 */
- @keyframes ball-x {
- 0% { transform:rotate(0deg);}
- 25% { transform:rotate(5deg); }
- 50% { transform:rotate(0deg);}
- 75% { transform:rotate(-5deg);}
- 100% { transform:rotate(0deg);}
- }
- @-webkit-keyframes ball-x {
- 0% { -webkit-transform:rotate(0deg);}
- 25% { -webkit-transform:rotate(5deg); }
- 50% { -webkit-transform:rotate(0deg);}
- 75% { -webkit-transform:rotate(-5deg);}
- 100% { -webkit-transform:rotate(0deg);}
- }
- @-moz-keyframes ball-x {
- 0% { -moz-transform:rotate(0deg);}
- 25% { -moz-transform:rotate(5deg); }
- 50% { -moz-transform:rotate(0deg);}
- 75% { -moz-transform:rotate(-5deg);}
- 100% { -moz-transform:rotate(0deg);}
- }
- </style>
页面鼠标点击特效
效果嘛……你在本页不断点击鼠标左键就能看到了(千万别上瘾哦~)
实现的方法很简单,还是老套路,在页面的任意位置加入如下代码即可(需要引入 jQuery)
- <script>
- jQuery(document).ready(function($) {
- $("html,body").click(function(e){
- var dfs=[
- "您刚才的点击使计生局放开了"+Math.floor(Math.random()*100)+"胎政策。",
- "您刚才的点击使黄石超级火山爆发了",
- "您刚才的点击使罗辑又换了一个女朋友",
- "您刚才的点击使小米公司收购了高通公司",
- "您刚才的点击引爆了"+Math.random()*10000+"光年外的一颗恒星",
- "您刚才的点击使头发变得乌黑浓密了",
- "您刚才的点击使您的波函数坍塌了",
- "您刚才的点击使您的银行卡被盗刷了",
- "您刚才的点击使普朗克常数扩大了十倍",
- "您刚才的点击熄灭了蓝色空间号二号主引擎",
- "您刚才的点击创造了一个小宇宙",
- "您刚才的点击使宇宙由开放转为闭合",
- "您刚才的点击让云天明和关一帆在一起了",
- "您刚才的点击使三体第"+Math.floor(Math.random()*100)+"舰队起航了",
- "您刚才的点击使第"+Math.floor(Math.random()*10000)+"号宇宙毁灭了",
- "您刚才的点击向太阳发射了一颗光粒",
- "您刚才的点击导致三体行星撞上他的主星",
- "您刚才的点击令人类文明将在"+(new Date()).getFullYear()+"年"+((new Date()).getMonth()+1)+"月"+(new Date()).getUTCDate()+"日23:59:59毁灭",
- "您刚才的点击启动了威慑系统",
- "您刚才的点击使谢顿计划脱离了正轨",
- "您刚才的点击使程心按下了威慑开关",
- "您刚才的点击引起了"+Math.random()*10000+"光年外一个行星的爆炸",
- "您刚才的点击使宇宙中产生了一些暗物质",
- "您刚才的点击引起了所有行星上的地震",
- "您刚才的点击使一台诺基亚摔碎了",
- "您刚才的点击使360云盘倒闭了",
- "您刚才的点击小米发布了MIX概念手机",
- "千万不要再次点击鼠标",
- "真的千万不要再次点击鼠标"
- ];
- var n=Math.floor(Math.random() * dfs.length + 1)-1; //随机获取一条数据
- var $i=$("<p/>").text(dfs[n]); //新建一个b标签,并显示随机的话语
- var x=e.pageX,y=e.pageY; //获取鼠标点击的x,和y
- $i.css({ //为标签赋予css值
- "z-index":99999,
- "top":y-20,
- "left":x,
- "position":"absolute",
- "color":"#E94F06",
- "font-family":"微软雅黑",
- "cursor":"default",
- "-moz-user-select": "none",
- "-webkit-user-select": "none",
- "-ms-user-select": "none",
- "-khtml-user-select": "none",
- "user-select": "none",
- });
- $("body").append($i); //在尾部插入
- $i.animate( {"top":y-180,"opacity":0}, 1500, function(){$i.remove();}); //动画消除
- e.stopPropagation();
- });
- });
- </script>
本文作者为mengkun,转载请注明。
第一个代码好像不太灵,我用的是360浏览器,还有那个点击文字,有效果,但是字太长好像重叠了...不知道是不是浏览器问题~
实验室的图片特效以及其他特效有点少啊,多多更新,好玩。 [wb_doge]
博主你看到我的网站怕是要开始念诗了 [wb_doge]
@苟利国蛤?
[…] 来源: 分享几段有趣的代码(一) | 孟坤博客 […]
<!--不错
这车开得真稳... [坏笑]
@龙轩导航不开稳点就要被请去喝茶了 [wb_二哈]
骚坤有没有新草榴论坛地址啊 [阴险]
@大东有的,有的 → http://t.cn/R6VARgH 低调使用,防止和谐 #(滑稽)
@mengkun[wb_doge] 这波稳了
查看图片 [坏笑]
博主经常看草榴啊,知道用繁体还知道1024
@xsj表示知道这个 1024 时它就倒闭了 [wb_二哈]