点击加分?算术题特效

先加载Jquery文件

jQuery(document).ready(function($){

$("html,body").click(function(e){

var y = new Array("+","-","*","/");

var n=Math.round(Math.random()*100)+1;

var i= 0;

var s = '';

while(i < Math.round(Math.random()*8)+1){

s = s + Math.round(Math.random()*100)+1 + y[Math.round(Math.random()*3)];

i = i + 1;

}

s = s + n;

var $i=$("").text(s+"="+eval(s));

var x=e.pageX,y=e.pageY;

$i.css({

"z-index":99999,

"top":y-20,

"left":x,

"position":"absolute",

"color":"#"+Math.round(Math.random()*16777215).toString(16)

});

$("body").append($i);

$i.animate(

{"top":y-180,"opacity":0},

3000,

function(){$i.remove();}

);

e.stopPropagation();

});

});

你可能感兴趣的:(点击加分?算术题特效)