-
-
Save aisin/0f4eb88d6d2cc8b8e9d0 to your computer and use it in GitHub Desktop.
点击页面随机飞出积分特效
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready(function($) { | |
$("html,body").click(function(e){ | |
var n=Math.round(Math.random()*100);//随机数 | |
var $i=$("<b/>").text("+"+n);//添加到页面的元素 | |
var x=e.pageX, y=e.pageY;//鼠标点击的位置 | |
$i.css({ | |
"z-index":99999, | |
"top":y-20, | |
"left":x-12, | |
"position":"absolute", | |
"color":"#E94F06" | |
}); | |
$("body").append($i); | |
$i.animate({ | |
"top":y-180,"opacity":0 | |
}, | |
1500, | |
function(){ | |
$i.remove(); | |
}); | |
e.stopPropagation(); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment