IE下元素空白区域(该元素在上img在下)与图片重叠
建站知识 2021-07-03 08:43www.168986.cn长沙网站建设
IE 下与元素重叠的区域为 img(该元素在上img在下),且该元素无背景(background:none、transparent),无可见内容(如 display none,visibllity hidden,left:-9999px; ) ,则该区域无法触发鼠标事件
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<title>test</title>
<style>
.ad-gallery{
position: relative;
width: 400px;
height: 350px;
overflow: hidden;
}
.ad-gallery .ad-prev,.ad-gallery .ad-next{
position: relative;
display: inline-block;
display: inline;
zoom:1;
float: left;
width:200px;
height: 100%;
z-index:100;
background-image: url('about:blank'); / IE ,与元素重叠的区域为 img(该元素在上img在下),且该元素无背景(background:none、transparent),无可见内容(如 display none,visibllity hidden,left:-9999px; ) ,则该区域无法触发鼠标事件 /
}
.ad-gallery .prevHandle ,.ad-gallery .nextHandle{
position:absolute;
left:0;
right: 0;
: 0;
bottom: 0;
margin:auto;
:50%;
left:50%;
margin-left: -50px;
margin-: -75px;
width: 100px;
height: 150px;
line-height: 150px;
background: #313131;
font-size: 14px;
text-align: center;
color: #ddd;
background: #313131;
display: none;
/visibility: hidden;/
/left:-9999px; /
}
.ad-gallery .ad-img{
position: absolute;
:0;
left:0;
z-index: 0;
width: 100%;
height: 100%;
}
.ad-gallery .desc{
position: absolute;
left: 0px;
bottom: 0px;
margin:0;
width: 100%;
height: 50px;
line-height: 50px;
background: #313131;
color: #eee;
text-indent: 10px;
z-index: 99;
}
.opacity60{
filter:alpha(opacity=60);/IE6、7/
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(opacity=60)"; /IE8/
opacity: 0.6;
}
</style>
</head>
<body>
<div id="gallery" class="ad-gallery">
<img class="ad-img" src="//img.jbzj./file_images/article/201301/2013118165025387.jpg" />
<div class="ad-prev"><div class="prevHandle opacity60">上一张</div></div>
<div class="ad-next"><div class="nextHandle opacity60">下一张</div></div>
<div class="desc opacity60">image description</div>
</div>
<!--test-->
<div style="position:relative;width:100px;height:111px;border:1px solid red;overflow:hidden;">
<img class="ad-img" width="100" height="50" src="http://images.blogs./blogs_/ecalf/431722/o_7_4c135bd08efea.jpg" />
<div style="position:absolute;left:0;:0;width:111px;height:100px;border:1px solid green;" onmouseover="alert(1);"></div>
</div>
<script>
var gallery = document.getElementById("gallery");
var elmInGallery = gallery.getElementsByTagName("");
var mouseover = function(event){
event = event||window.event;
var target = (event.srcElement||event.target);
console.log('============= event log ===============');
console.log('1. ',this.className,' | ',target.className,' | ',target==this?'eventSrc':'eventTraval');
if((/ad-prev|ad-next/).test(this.className)){
console.log('2. ','handle active');
this.getElementsByTagName("div")[0].style.display = "block";
}
};
for(var i=0;i<elmInGallery.length;i++){
elmInGallery[i].onmouseover = mouseover;
}
</script>
</body>
</html>
复制代码
代码如下:<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<title>test</title>
<style>
.ad-gallery{
position: relative;
width: 400px;
height: 350px;
overflow: hidden;
}
.ad-gallery .ad-prev,.ad-gallery .ad-next{
position: relative;
display: inline-block;
display: inline;
zoom:1;
float: left;
width:200px;
height: 100%;
z-index:100;
background-image: url('about:blank'); / IE ,与元素重叠的区域为 img(该元素在上img在下),且该元素无背景(background:none、transparent),无可见内容(如 display none,visibllity hidden,left:-9999px; ) ,则该区域无法触发鼠标事件 /
}
.ad-gallery .prevHandle ,.ad-gallery .nextHandle{
position:absolute;
left:0;
right: 0;
: 0;
bottom: 0;
margin:auto;
:50%;
left:50%;
margin-left: -50px;
margin-: -75px;
width: 100px;
height: 150px;
line-height: 150px;
background: #313131;
font-size: 14px;
text-align: center;
color: #ddd;
background: #313131;
display: none;
/visibility: hidden;/
/left:-9999px; /
}
.ad-gallery .ad-img{
position: absolute;
:0;
left:0;
z-index: 0;
width: 100%;
height: 100%;
}
.ad-gallery .desc{
position: absolute;
left: 0px;
bottom: 0px;
margin:0;
width: 100%;
height: 50px;
line-height: 50px;
background: #313131;
color: #eee;
text-indent: 10px;
z-index: 99;
}
.opacity60{
filter:alpha(opacity=60);/IE6、7/
-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(opacity=60)"; /IE8/
opacity: 0.6;
}
</style>
</head>
<body>
<div id="gallery" class="ad-gallery">
<img class="ad-img" src="//img.jbzj./file_images/article/201301/2013118165025387.jpg" />
<div class="ad-prev"><div class="prevHandle opacity60">上一张</div></div>
<div class="ad-next"><div class="nextHandle opacity60">下一张</div></div>
<div class="desc opacity60">image description</div>
</div>
<!--test-->
<div style="position:relative;width:100px;height:111px;border:1px solid red;overflow:hidden;">
<img class="ad-img" width="100" height="50" src="http://images.blogs./blogs_/ecalf/431722/o_7_4c135bd08efea.jpg" />
<div style="position:absolute;left:0;:0;width:111px;height:100px;border:1px solid green;" onmouseover="alert(1);"></div>
</div>
<script>
var gallery = document.getElementById("gallery");
var elmInGallery = gallery.getElementsByTagName("");
var mouseover = function(event){
event = event||window.event;
var target = (event.srcElement||event.target);
console.log('============= event log ===============');
console.log('1. ',this.className,' | ',target.className,' | ',target==this?'eventSrc':'eventTraval');
if((/ad-prev|ad-next/).test(this.className)){
console.log('2. ','handle active');
this.getElementsByTagName("div")[0].style.display = "block";
}
};
for(var i=0;i<elmInGallery.length;i++){
elmInGallery[i].onmouseover = mouseover;
}
</script>
</body>
</html>
长沙网站设计
- 如何自己建一个网站 自己想建个网站,怎么建
- 如何制作网站免费建站 创建网站免费注册
- html简单网页代码 html简单网页代码超链接
- dreamweaver网页制作 dreamweaver网页制作模板
- 上海网站建设 上海网站建设制作微信
- 如何制作网站和网页 如何制作一个网页
- html网页制作代码大全 端午节html网页制作代码大
- app开发公司 app开发公司前十名
- html网页制作 html网页制作文字居中
- app制作一个需要多少钱 请人制作一个app多少钱
- 成都网站制作 成都网站制作维护
- 百度建一个网站多少钱 百度做个公司网站要多少
- html+css网页制作成品 web网页制作成品css+javascrip
- html网页制作案例 html网页设计案例
- html+css网页制作成品 web网页制作成品css+javascrip
- 个人网站模板 个人网站模板HTML