惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

aimingoo的专栏
aimingoo的专栏
Y
Y Combinator Blog
云风的 BLOG
云风的 BLOG
Microsoft Azure Blog
Microsoft Azure Blog
腾讯CDC
T
The Blog of Author Tim Ferriss
P
Proofpoint News Feed
Hugging Face - Blog
Hugging Face - Blog
博客园_首页
小众软件
小众软件
美团技术团队
Martin Fowler
Martin Fowler
爱范儿
爱范儿
有赞技术团队
有赞技术团队
博客园 - 【当耐特】
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Microsoft Security Blog
Microsoft Security Blog
宝玉的分享
宝玉的分享
J
Java Code Geeks
B
Blog
V
V2EX
Stack Overflow Blog
Stack Overflow Blog
B
Blog RSS Feed
博客园 - Franky

博客园 - 赏音师

漂亮工具 .NET 4 新建 webform 项目编译不通过 MySQL 知乎 zhihu 用户中心 - 博客园 实木家具 玩具 用户中心 - 博客园 jQuery $.each的使用方法 js刷新页面的几种方法 常用JS验证和函数 js判断手机浏览器操作系统和微信浏览器的方法 电影 备用礼品 ASP.NET 预编译 网络安全监测 GitHub CSS jQuery HTML5 CSS3 情趣小玩意
js单击显示元素,点击元素本身以外隐藏元素
赏音师 · 2015-09-07 · via 博客园 - 赏音师
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<title>网页特效展示中心</title> 
<style type="text/css"> 
.pop { width:200px; height:130px; background:#080;} 
</style> 
</head> 
<body> 
<script type="text/javascript" src="http://www.9ku.com/v2014/js/jquery.js"></script> 
<script type="text/javascript"> 
$(function(){ 
$(document).bind("click",function(e){ 
var target = $(e.target); 
if(target.closest(".pop").length == 0){ 
$(".pop").hide(); 
} 
}) 
}) 
</script> 
<div class="pop"></div> 
点击空白的地方指定div 隐藏消失了 
</body> 
</html> 

from:http://www.wufangbo.com/js-dan-ji-yin-chang/

posted @ 2015-09-07 23:11  赏音师  阅读(1622)  评论()    收藏  举报