首页
Python
Java
IOS
Andorid
NodeJS
JavaScript
HTML5
【
怎么点击div之外的区域就隐藏这个div啊 找了很久,都没有很好解决
】的更多相关文章
怎么点击div之外的区域就隐藏这个div啊 找了很久,都没有很好解决
方法一. <!DOCTYPE html><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>无标题文档</title></head><body> <span onClick="with(document.getElementById(…
Jquery点击除了指定div元素其他地方,隐藏该div
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <script type="text/javascript" src="js/jquery.min.js"></script> <title></title> <script type="text/javascript"&…
js构建函数,点击按钮显示div,再点击按钮或其他区域,隐藏div
这只是一个例子,先看看效果: html代码: <nav> <span class="nav_logo"></span> <h1>云蚂客首页</h1> <button class="nav_btn"></button> <ul class="menu"> <li><a href="#">首页</a>…
js实现的点击div区域外隐藏div区域
首先看下JS的事件模型,JS事件模型为向上冒泡,如onclick事件在某一DOM元素被触发后,事件将跟随节点向上传播,直到有click事件绑定在某一父节点上,如果没有将直至文档的根. 阻止冒泡:1.对于非IE浏览器:stopPropagation().2.对于IE浏览器:cancelBubble属性为true <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&qu…
点击区域外隐藏该区域,event.stopPropagation()
event.stopPropagation() Description: Prevents the event from bubbling up the DOM tree, preventing any parent handlers from being notified of the event. 点击区域外隐藏该区域Example: <!DOCTYPE html> <html> <head> <meta content="charset=utf-8…
点击页面其它地方隐藏该div的两种思路
思路一 第一种思路分两步 第一步:对document的click事件绑定事件处理程序,使其隐藏该div 第二步:对div的click事件绑定事件处理程序,阻止事件冒泡,防止其冒泡到document,而调用document的onclick方法隐藏了该div. 复制代码 代码如下: <script type="text/javascript"> function stopPropagation(e) { if (e.stopPropagation) e.stopPropagat…
点击页面其它地方隐藏该div的方法
思路一 第一种思路分两步 第一步:对document的click事件绑定事件处理程序,使其隐藏该div 第二步:对div的click事件绑定事件处理程序,阻止事件冒泡,防止其冒泡到document,而调用document的onclick方法隐藏了该div. <script type="text/javascript"> function stopPropagation(e) { if (e.stopPropagation) e.stopPropagation(); else…
js实现点击按钮时显示弹框,点击按钮及弹框以外的区域时隐藏弹框
转自https://blog.csdn.net/yimawujiang/article/details/86496936 问题:js实现点击按钮时显示弹框,点击按钮及弹框以外的区域时隐藏弹框? 方案一:这个问题通常的办法是使用阻止事件冒泡来实现,代码如下(省略css): <body> <button id="btn1" onclick="alertBoxFn();stopBubble()">打开弹窗</button> <di…
jquery点击元素之外触发事件
$("#errorMsg_layer").bind("click",function(e){ if($(e.target).closest("#errorMsg_div").length == 0){ foo(); } });//点击 #errorMsg_div 之外触发foo()方法.…
设立点击ProgressDialog外的区域对话框不消失
设置点击ProgressDialog外的区域对话框不消失ProgressDialog mpDialog = new ProgressDialog(OrderTable.this); mpDialog.setProgressStyle(ProgressDialog.STYLE_SPINNER);//设置风格为圆形进度条 mpDialog.setTitle("提示");//设置标题 mpDialog.setIcon(R.drawable.icon);//设置图标 mpDial…