Advertisement
Emiliatan

blog_elf_js

Jun 27th, 2019
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 8.95 KB | None | 0 0
  1. //鼠标在消息上时
  2. jQuery(document).ready(function ($) {
  3.     $("#message").hover(function () {
  4.        $("#message").fadeTo("100", 1);
  5.      });
  6. });
  7.  
  8.  
  9. //鼠标在上方时
  10. jQuery(document).ready(function ($) {
  11.     //$(".mumu").jrumble({rangeX: 2,rangeY: 2,rangeRot: 1});
  12.     $(".mumu").mouseover(function () {
  13.        $(".mumu").fadeTo("300", 0.3);
  14.        msgs = ["我隐身了,你看不到我", "我会隐身哦!嘿嘿!", "别动手动脚的,把手拿开!", "把手拿开我才出来!"];
  15.        var i = Math.floor(Math.random() * msgs.length);
  16.         showMessage(msgs[i]);
  17.     });
  18.     $(".mumu").mouseout(function () {
  19.         $(".mumu").fadeTo("300", 1)
  20.     });
  21. });
  22.  
  23.  
  24. //开始
  25. jQuery(document).ready(function ($) {
  26.     if (isindex) { //如果是主页
  27.         var now = (new Date()).getHours();
  28.         if (now > 0 && now <= 6) {
  29.             showMessage(visitor + ' 你是夜猫子呀?还不睡觉,明天起的来么你?', 6000);
  30.         } else if (now > 6 && now <= 11) {
  31.             showMessage(visitor + ' 早上好,早起的鸟儿有虫吃噢!早起的虫儿被鸟吃,你是鸟儿还是虫儿?嘻嘻!', 6000);
  32.         } else if (now > 11 && now <= 14) {
  33.             showMessage(visitor + ' 中午了,吃饭了么?不要饿着了,饿死了谁来挺我呀!', 6000);
  34.         } else if (now > 14 && now <= 18) {
  35.             showMessage(visitor + ' 中午的时光真难熬!还好有你在!', 6000);
  36.         } else {
  37.             showMessage(visitor + ' 快来逗我玩吧!', 6000);
  38.         }
  39.     }
  40.     else {
  41.         showMessage('欢迎' + visitor + '来到《' + title + '》', 6000);
  42.     }
  43.     $(".spig").animate({
  44.         top: $(".spig").offset().top + 300,
  45.         left: document.body.offsetWidth - 185
  46.     },
  47.     {
  48.         queue: false,
  49.         duration: 1000
  50.     });
  51. });
  52.  
  53. //鼠标在某些元素上方时
  54. jQuery(document).ready(function ($) {
  55.     $('h2 a').click(function () {//标题被点击时
  56.         showMessage('萌萌地加载《<span style="color:#0099cc;">' + $(this).text() + '</span>》中,请稍候');
  57.     });
  58.     $('h2 a').mouseover(function () {
  59.         showMessage('要看看《<span style="color:#0099cc;">' + $(this).text() + '</span>》这篇随笔么?');
  60.     });
  61.     $('#prev-page').mouseover(function(){
  62.         showMessage('要翻到上一页吗?');
  63.     });
  64.     $('#next-page').mouseover(function(){
  65.         showMessage('要翻到下一页吗?');
  66.     });
  67.     $('#index-links li a').mouseover(function () {
  68.         showMessage('去 <span style="color:#0099cc;">' + $(this).text() + '</span> 逛逛');
  69.     });
  70.     $('.tbCommentBodys').mouseover(function () {
  71.         showMessage('<span style="color:#0099cc;">' + visitor + '</span> 向评论栏出发吧!');
  72.     });
  73.     $('#submit').mouseover(function () {
  74.         showMessage('确认提交了么?');
  75.     });
  76.     $('#s').focus(function () {
  77.         showMessage('输入你想搜索的关键词再按Enter(回车)键就可以搜索啦!');
  78.     });
  79.     $('#go-prev').mouseover(function () {
  80.         showMessage('点它可以后退哦!');
  81.     });
  82.     $('#go-next').mouseover(function () {
  83.         showMessage('点它可以前进哦!');
  84.     });
  85.     $('#refresh').mouseover(function () {
  86.         showMessage('点它可以重新载入此页哦!');
  87.     });
  88.     $('#go-home').mouseover(function () {
  89.         showMessage('点它就可以回到首页啦!');
  90.     });
  91.     $('#addfav').mouseover(function () {
  92.         showMessage('点它可以把此页加入书签哦!');
  93.     });
  94.     $('#nav-two a').mouseover(function () {
  95.         showMessage('嘘,从这里可以进入控制面板的哦!');
  96.     });
  97.     $('.post-category a').mouseover(function () {
  98.         showMessage('点击查看此分类下得所有文章');
  99.     });
  100.     $('.post-heat a').mouseover(function () {
  101.         showMessage('点它可以直接跳到评论列表处.');
  102.     });
  103.     $('#tho-shareto span a').mouseover(function () {
  104.         showMessage('你知道吗?点它可以分享本文到'+$(this).attr('title'));
  105.     });
  106.     $('#switch-to-wap').mouseover(function(){
  107.         showMessage('点击可以切换到手机版博客版面');
  108.     });
  109. });
  110.  
  111.  
  112. //无聊讲点什么
  113. jQuery(document).ready(function ($) {
  114.  
  115.     window.setInterval(function () {
  116.         msgs = [ "陪我聊天吧!", "好无聊哦,你都不陪我玩!", "…@……!………", "^%#&*!@*(&#)(!)(", "我可爱吧!嘻嘻!~^_^!~~","谁淫荡呀?~谁淫荡?,你淫荡呀!~~你淫荡!~~","从前有座山,山上有座庙,庙里有个老和尚给小和尚讲故事,讲:“从前有座……”"];
  117.         var i = Math.floor(Math.random() * msgs.length);
  118.         showMessage(msgs[i], 8000);
  119.     }, 15000);
  120. });
  121. //评论资料
  122. jQuery(document).ready(function ($) {
  123.     $("#author").click(function () {
  124.         showMessage("留下你的尊姓大名!");
  125.         $(".spig").animate({
  126.             top: $("#author").offset().top - 70,
  127.             left: $("#author").offset().left - 170
  128.         },
  129.         {
  130.             queue: false,
  131.             duration: 1000
  132.         });
  133.     });
  134.     $("#email").click(function () {
  135.         showMessage("留下你的邮箱,不然就是无头像人士了!");
  136.         $(".spig").animate({
  137.             top: $("#email").offset().top - 70,
  138.             left: $("#email").offset().left - 170
  139.         },
  140.         {
  141.             queue: false,
  142.             duration: 1000
  143.         });
  144.     });
  145.     $("#url").click(function () {
  146.  
  147.         showMessage("快快告诉我你的家在哪里,好让我去参观参观!");
  148.         $(".spig").animate({
  149.             top: $("#url").offset().top - 70,
  150.             left: $("#url").offset().left - 170
  151.         },
  152.         {
  153.             queue: false,
  154.             duration: 1000
  155.         });
  156.     });
  157.     $("#tbCommentBody").click(function () {
  158.         showMessage("认真填写哦!不然会被认作垃圾评论的!我的乖乖~");
  159.         $(".spig").animate({
  160.             top: $("#tbCommentBody").offset().top - 70,
  161.             left: $("#tbCommentBody").offset().left - 170
  162.         },
  163.         {
  164.             queue: false,
  165.             duration: 1000
  166.         });
  167.     });
  168. });
  169.  
  170. var spig_top = 50;
  171. //滚动条移动
  172. jQuery(document).ready(function ($) {
  173.     var f = $(".spig").offset().top;
  174.     $(window).scroll(function () {
  175.         $(".spig").animate({
  176.             top: $(window).scrollTop() + f +300
  177.         },
  178.         {
  179.             queue: false,
  180.             duration: 1000
  181.         });
  182.     });
  183. });
  184.  
  185. //鼠标点击时
  186. jQuery(document).ready(function ($) {
  187.     var stat_click = 0;
  188.     $(".mumu").click(function () {
  189.        
  190.             stat_click++;
  191.             if (stat_click > 4) {
  192.                 msgs = ["你有完没完呀?", "你已经摸我" + stat_click + "次了", "非礼呀!救命!OH,My ladygaga"];
  193.                 var i = Math.floor(Math.random() * msgs.length);
  194.                 //showMessage(msgs[i]);
  195.             } else {
  196.                 msgs = ["筋斗云!~我飞!", "我跑呀跑呀跑!~~", "别摸我,大男人,有什么好摸的!", "惹不起你,我还躲不起你么?", "不要摸我了,我会告诉老婆来打你的!", "干嘛动我呀!小心我咬你!"];
  197.                 var i = Math.floor(Math.random() * msgs.length);
  198.                 //showMessage(msgs[i]);
  199.             }
  200.         s = [0.1, 0.2, 0.3, 0.4, 0.5, 0.6,0.7,0.75,-0.1, -0.2, -0.3, -0.4, -0.5, -0.6,-0.7,-0.75];
  201.         var i1 = Math.floor(Math.random() * s.length);
  202.         var i2 = Math.floor(Math.random() * s.length);
  203.             $(".spig").animate({
  204.             left: document.body.offsetWidth/2*(1+s[i1]),
  205.             top:  document.body.offsetheight/2*(1+s[i1])
  206.             },
  207.             {
  208.                 duration: 500,
  209.                 complete: showMessage(msgs[i])
  210.             });
  211.        
  212.     });
  213. });
  214.  
  215.  
  216. //显示消息函数
  217. function showMessage(a, b) {
  218.     if (b == null) b = 10000;
  219.     jQuery("#message").hide().stop();
  220.     jQuery("#message").html(a);
  221.     jQuery("#message").fadeIn();
  222.     jQuery("#message").fadeTo("1", 1);
  223.     jQuery("#message").fadeOut(b);
  224. };
  225.  
  226. //拖动
  227. var _move = false;
  228. var ismove = false; //移动标记
  229. var _x, _y; //鼠标离控件左上角的相对位置
  230. jQuery(document).ready(function ($) {
  231.     $("#spig").mousedown(function (e) {
  232.         _move = true;
  233.         _x = e.pageX - parseInt($("#spig").css("left"));
  234.         _y = e.pageY - parseInt($("#spig").css("top"));
  235.      });
  236.     $(document).mousemove(function (e) {
  237.         if (_move) {
  238.             var x = e.pageX - _x;
  239.             var y = e.pageY - _y;
  240.             var wx = $(window).width() - $('#spig').width();
  241.             var dy = $(document).height() - $('#spig').height();
  242.             if(x >= 0 && x <= wx && y > 0 && y <= dy) {
  243.                 $("#spig").css({
  244.                     top: y,
  245.                     left: x
  246.                 }); //控件新位置
  247.             ismove = true;
  248.             }
  249.         }
  250.     }).mouseup(function () {
  251.         _move = false;
  252.     });
  253. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement