IE 7 下, 先隐藏 父元素,后隐藏子元素,再显示父元素, 被隐藏的子元素 重叠区域下面, 存在另一个可见的元素, 则该 display:none的子元素出现BUG:
背景和图片(img元素,不仅仅是图片背景)仍然显示, 但文字不显示,可以触发鼠标事件。
复制代码代码如下:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<title>test display none</title>
<style>
.gallery{
position: absolute;
top:100px;
left:100px;
padding:10px;
overflow: hidden;
background:#464646;
}
.ad-image{
position: relative;
width:580px;
overflow: hidden;
text-align: center;
}
.ad-image img{
width:100%;
}
.ad-image-groupTip{
position: absolute;
top:50%;
left:50%;
margin-top:-50px;
margin-left: -111px;
width:222px;
height: 100px;
background:none #313131;
z-index:999;
font-size:14px;
}
.ad-image-grouplast{
width:100%;
height:39px;
line-height: 39px;
border-bottom: 1px solid #000;
color:#fff;
}
.ad-image-action{
height:59px;
line-height: 59px;
width:100%;
border-top: 1px solid #555;
color:#39c;
}
.ad-image-groupTip .tipLeft{
float: left;
}
.ad-image-groupTip .tipRight{
float:right;
}
.tipClose{
cursor:pointer;
}
.ad-image-groupTip span{
margin:auto 12px;
}
.ad-image-action span{
cursor:pointer;
vertical-align: middle;
}
.ad-image-action span i{
display:inline-block;
vertical-align: text-top;
width:20px;
height:16px;
*display: inline;
*zoom:1;
*vertical-align: middle;
}
.ad-gallery .imgOperate{
position:absolute;
top: 50px;
left: 6px;
height: 30px;
line-height: 30px;
}
.ad-gallery .imgOperate a{
color:#39c;
cursor:pointer;
}
.ad-image-action .review{
background: url(http://images.cnblogs.com/cnblogs_com/ecalf/431722/o_icons.png) scroll no-repeat 0px 0px;
}
.ad-image-action .goon{
background: url(http://images.cnblogs.com/cnblogs_com/ecalf/431722/o_icons.png) no-repeat scroll 0px -16px;
}
.testBtns{
position: relative;
top:100px;
left:730px;
width:100px;
}
.testBtns button{
width:100px;
height: 30px;
text-align: center;
border:1px solid #313131;
margin-bottom: 10px;
}
</style>
</head>
<body>
<div id="gallery" class="gallery">
<div id="ad-image" class="ad-image">
<img src="/UploadFiles/2021-03-30/o_7_4c135bd08efea.jpg"></div>
<div id="groupTip" class="ad-image-groupTip" >
<div class="ad-image-grouplast">
<span class=tipLeft>已经是最后一张</span>
<span class="tipRight tipClose" >×</span>
</div>
<div class="ad-image-action">
<span class="tipLeft">
<i class="review"></i>重新浏览
</span>
<span class="tipRight">
<i class=goon></i>下一个作品
</span>
</div>
</div>
</div>
<div class="testBtns">
<button id="btn1" data-rel="gallery">triggle gallery</button>
<button id="btn2" data-rel="ad-image">triggle ad-img</button>
<button id="btn3" data-rel="groupTip">triggle tip</button>
<p>IE7先隐藏gallery后隐藏tip,再显示gallery,bug出现</p>
</div>
<script>
document.getElementById("btn1").onclick =
document.getElementById("btn2").onclick =
document.getElementById("btn3").onclick = function(){
var relId = this.getAttribute("data-rel");
var style = document.getElementById(relId).style;
style.display = (style.display=='none')?'':'none';
}
document.getElementById("groupTip").onmouseover = function(){
alert(this.id);
}
</script>
</body>
</html>
背景和图片(img元素,不仅仅是图片背景)仍然显示, 但文字不显示,可以触发鼠标事件。
复制代码代码如下:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<title>test display none</title>
<style>
.gallery{
position: absolute;
top:100px;
left:100px;
padding:10px;
overflow: hidden;
background:#464646;
}
.ad-image{
position: relative;
width:580px;
overflow: hidden;
text-align: center;
}
.ad-image img{
width:100%;
}
.ad-image-groupTip{
position: absolute;
top:50%;
left:50%;
margin-top:-50px;
margin-left: -111px;
width:222px;
height: 100px;
background:none #313131;
z-index:999;
font-size:14px;
}
.ad-image-grouplast{
width:100%;
height:39px;
line-height: 39px;
border-bottom: 1px solid #000;
color:#fff;
}
.ad-image-action{
height:59px;
line-height: 59px;
width:100%;
border-top: 1px solid #555;
color:#39c;
}
.ad-image-groupTip .tipLeft{
float: left;
}
.ad-image-groupTip .tipRight{
float:right;
}
.tipClose{
cursor:pointer;
}
.ad-image-groupTip span{
margin:auto 12px;
}
.ad-image-action span{
cursor:pointer;
vertical-align: middle;
}
.ad-image-action span i{
display:inline-block;
vertical-align: text-top;
width:20px;
height:16px;
*display: inline;
*zoom:1;
*vertical-align: middle;
}
.ad-gallery .imgOperate{
position:absolute;
top: 50px;
left: 6px;
height: 30px;
line-height: 30px;
}
.ad-gallery .imgOperate a{
color:#39c;
cursor:pointer;
}
.ad-image-action .review{
background: url(http://images.cnblogs.com/cnblogs_com/ecalf/431722/o_icons.png) scroll no-repeat 0px 0px;
}
.ad-image-action .goon{
background: url(http://images.cnblogs.com/cnblogs_com/ecalf/431722/o_icons.png) no-repeat scroll 0px -16px;
}
.testBtns{
position: relative;
top:100px;
left:730px;
width:100px;
}
.testBtns button{
width:100px;
height: 30px;
text-align: center;
border:1px solid #313131;
margin-bottom: 10px;
}
</style>
</head>
<body>
<div id="gallery" class="gallery">
<div id="ad-image" class="ad-image">
<img src="/UploadFiles/2021-03-30/o_7_4c135bd08efea.jpg"></div>
<div id="groupTip" class="ad-image-groupTip" >
<div class="ad-image-grouplast">
<span class=tipLeft>已经是最后一张</span>
<span class="tipRight tipClose" >×</span>
</div>
<div class="ad-image-action">
<span class="tipLeft">
<i class="review"></i>重新浏览
</span>
<span class="tipRight">
<i class=goon></i>下一个作品
</span>
</div>
</div>
</div>
<div class="testBtns">
<button id="btn1" data-rel="gallery">triggle gallery</button>
<button id="btn2" data-rel="ad-image">triggle ad-img</button>
<button id="btn3" data-rel="groupTip">triggle tip</button>
<p>IE7先隐藏gallery后隐藏tip,再显示gallery,bug出现</p>
</div>
<script>
document.getElementById("btn1").onclick =
document.getElementById("btn2").onclick =
document.getElementById("btn3").onclick = function(){
var relId = this.getAttribute("data-rel");
var style = document.getElementById(relId).style;
style.display = (style.display=='none')?'':'none';
}
document.getElementById("groupTip").onmouseover = function(){
alert(this.id);
}
</script>
</body>
</html>
标签:
父元素,子元素,隐藏顺序
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
岱庙资源网 Copyright www.zgmyg.com
暂无“IE7下父元素及子元素的隐藏顺序不当带来的display:none出现BUG”评论...
RTX 5090要首发 性能要翻倍!三星展示GDDR7显存
三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。
首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。
据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。
更新日志
2024年11月16日
2024年11月16日
- 第五街的士高《印度激情版》3CD [WAV+CUE][2.4G]
- 三国志8重制版哪个武将智力高 三国志8重制版智力武将排行一览
- 三国志8重制版哪个武将好 三国志8重制版武将排行一览
- 三国志8重制版武将图像怎么保存 三国志8重制版武将图像设置方法
- 何方.1990-我不是那种人【林杰唱片】【WAV+CUE】
- 张惠妹.1999-妹力新世纪2CD【丰华】【WAV+CUE】
- 邓丽欣.2006-FANTASY【金牌大风】【WAV+CUE】
- 饭制《黑神话》蜘蛛四妹手办
- 《燕云十六声》回应跑路:年内公测版本完成95%
- 网友发现国内版《双城之战》第二季有删减:亲亲环节没了!
- 邓丽君2024-《漫步人生路》头版限量编号MQA-UHQCD[WAV+CUE]
- SergeProkofievplaysProkofiev[Dutton][FLAC+CUE]
- 永恒英文金曲精选4《TheBestOfEverlastingFavouritesVol.4》[WAV+CUE]
- 群星《国风超有戏 第9期》[320K/MP3][13.63MB]
- 群星《国风超有戏 第9期》[FLAC/分轨][72.56MB]