JS点击页面出现赞效果
JS点击页面出现赞效果,点击页面任何地方出现随机的数字向上漂浮效果,挺炫的一种效果。
完整代码:
效果截图:

<title>JS点击页面出现赞效果</title>
<script src="http://libs.baidu.com/jquery/1.9.0/jquery.js"></script>
<script>
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,
"position": "absolute",
"color": "#E94F06"
});
$("body").append($i);
$i.animate({
"top": y - 180,
"opacity": 0
},
1500,
function() {
$i.remove();
});
e.stopPropagation();
});
});
</script>
<p>请用鼠标左键点击页面查看效果</p> 相关文章
- JS邮箱验证函数
JS邮箱验证函数。 关键代码: 复制代码 代码如下: function emailCheck(str){ return /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/.test(str); } 使用方法: emailCheck(邮箱); alert(emailCheck(10001
- 标题滚动效果演示
纯JS实现的标题滚动效果。代码如下: 复制代码 代码如下: script type=text/javascript (function(){ setInterval(function(){ text = top.document.title; top.document.title=text.substring(1,text.length)+text.substring(0,1); },500); })(); /script
- HTML图片热区map area谷歌浏览器Google去除边框
HTML图片热区map area去除边框默认的情况下 在Google浏览器中打开的时候周围会有蓝色的边框。 在area中加入以下代码可以去除边框: hidefocus=true onfocus=this.blur(); 完整代码如下: 复制代码 代码如下: img src=http://www.120muban.com/statics/images/l
- 移动端全屏滚动插件 zepto.fullpage.js
zepto.fullpage 是专注于移动端的 fullPag e.js ,依赖 Ze pto 。 下载地址: https://github.com/yanhaijing/zepto.fullpage 功能概述 可实现移动端的单页滚动效果,可自定义参数,提供回调接口,和公开接口。 兼容性 Ios4+ Andriod2.3+(未全部覆盖) 快速
- html5输入框正则验证
html5输入框正则验证,输入框禁止粘贴,禁止右键菜单。
随机推荐
- JS邮箱验证函数
JS邮箱验证函数。 关键代码: 复制代码 代码如下: function emailCheck(str){ return /^([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+@([a-zA-Z0-9]+[_|\_|\.]?)*[a-zA-Z0-9]+\.[a-zA-Z]{2,3}$/.test(str); } 使用方法: emailCheck(邮箱); alert(emailCheck(10001
- 标题滚动效果演示
纯JS实现的标题滚动效果。代码如下: 复制代码 代码如下: script type=text/javascript (function(){ setInterval(function(){ text = top.document.title; top.document.title=text.substring(1,text.length)+text.substring(0,1); },500); })(); /script
- HTML图片热区map area谷歌浏览器Google去除边框
HTML图片热区map area去除边框默认的情况下 在Google浏览器中打开的时候周围会有蓝色的边框。 在area中加入以下代码可以去除边框: hidefocus=true onfocus=this.blur(); 完整代码如下: 复制代码 代码如下: img src=http://www.120muban.com/statics/images/l
- 移动端全屏滚动插件 zepto.fullpage.js
zepto.fullpage 是专注于移动端的 fullPag e.js ,依赖 Ze pto 。 下载地址: https://github.com/yanhaijing/zepto.fullpage 功能概述 可实现移动端的单页滚动效果,可自定义参数,提供回调接口,和公开接口。 兼容性 Ios4+ Andriod2.3+(未全部覆盖) 快速
- html5输入框正则验证
html5输入框正则验证,输入框禁止粘贴,禁止右键菜单。