Add the special effect of clicking red numbers or slogans to the website

 Watson Blog September 5, 2017 17:11:03 JS/jQuery comment seven hundred and thirty-three Reading mode

给网站添加鼠标点击红色数字或标语上升特效
Add the js code directly to footer.php.

Click the mouse, red random number rise special effect code

  1. /**   
  2. *Add the special effect of clicking red numbers to the website  
  3.  *  http://wosn.net/301.html    
  4.  */     
  5. <script>  
  6.     jQuery(document).ready(function($) {  
  7.     var _click_count= zero ;   
  8.     $( "body" ).bind( "click" ,function(e){  //Give the body an event directly   
  9.     var n=Math.round(Math.random()* one hundred ); //Random number   
  10.     // var $i=$("<b>").text("+"+(++_click_count));// Elements added to the page   
  11.      var $i=$( "<b>" ).text( "+" +(++n)); //Elements added to the page   
  12.     var x=e.pageX,y=e.pageY; //Mouse click position   
  13.     $i.css({  
  14.      "z-index" : ninety-nine thousand nine hundred and ninety-nine ,  
  15.      "top" :y- fifteen ,  
  16.      "left" :x,  
  17.      "position" : "absolute" ,  
  18.      "color" : "red"   
  19.     });   
  20.     $( "body" ).append($i);   
  21.     $i.animate(  
  22.     { "top" :y- one hundred and eighty , "opacity" : zero },  
  23.      one thousand and five hundred ,  
  24.     function(){$i.remove();}  
  25.     );   
  26.     e.stopPropagation();   
  27.     });   
  28.     });   
  29.     </script>  

Click the mouse, the red slogan rises the special effect code

  1. /**   
  2. *Add a special effect to the website by clicking the red slogan  
  3.  *  http://wosn.net/301.html    
  4.  */     
  5.  <script type= "text/javascript" >  
  6.     var a_idx =  zero ;   
  7.     jQuery(document).ready(function($) {  
  8.         $( "body" ).click(function(e) {  
  9.             var a =  new  Array( "Rich and strong" Democracy "Civilization" "Harmony" Freedom Equality "Justice"  , "Rule of law" "Patriotic" "Dedicated" "Integrity" Friendly );   
  10.             var $i = $( "<span/>" ).text(a[a_idx]);   
  11.             a_idx = (a_idx +  one ) % a.length;   
  12.             var x = e.pageX,  
  13.             y = e.pageY;   
  14.             $i.css({  
  15.                  "z-index" 9999999999999999999999999999999999999999 ,  
  16.                  "top" : y -  twenty ,  
  17.                  "left" : x,  
  18.                  "position" "absolute" ,  
  19.                  "font-weight" "bold" ,  
  20.                  "color" "#ff6651"   
  21.             });   
  22.             $( "body" ).append($i);   
  23.             $i.animate({  
  24.                  "top" : y -  one hundred and eighty ,  
  25.                  "opacity" zero   
  26.             },  
  27.              one thousand and five hundred ,  
  28.             function() {  
  29.                 $i.remove();   
  30.             });   
  31.         });   
  32.     });   
  33.     </script>  

 Watson Blog
  • This article is written by Published on September 5, 2017 17:11:03
  • This article is collected and sorted by the website of Mutual Benefit, and the email address for problem feedback is: wosnnet@foxmail.com , please keep the link of this article for reprinting: https://wosn.net/301.html

Comment