[英]How to make this an entirely clickable DIV
单击以下DIV时,我正在使用JQuery隐藏DIV
.up_link {
position: absolute;
width: 830px;
height: 500px;
z-index: 8;
text-align: center;
cursor: pointer;
border: 3px solid #000;
}
在Firefox中可以正常工作,但在IE中则不能。 我可以在Firefox中单击整个DIV,但在IE中仅单击边框。
$(function() {
$(".down_link").click(function() {
$(".gallery_block2").stop(true, true).hide().animate({ marginTop: 0 }, 400).fadeTo(500,1).show();
});
$(".up_link").click(function() {
$(".gallery_block2").stop(true, true).fadeTo(500,0).show().animate({ marginTop: -550 }, 400);
});
});
HTML
<div class="gallery_block2">
<div class="gallery_thumbs">
<div class="gallery_close_container up_link"></div>
<div class="load_space"></div>
</div>
</div>
任何帮助表示赞赏。
可能的问题:没有背景(或background-color: transparent
)的元素在单击(非)背景时不会触发IE中的单击事件(至少6-8,不确定9)。
解决方法:
1)如果您不需要透明背景:
background-color: #000000; /* Color of whatever's behind the <div> */
2)如果您不需要边框或任何文本内容:
background-color: #000000;
filter: alpha(opacity = 0);
opacity: 0;
/* And vendor prefixes for older browsers, e.g. -moz-opacity */
...使整个元素透明,但可单击。
3)如果您只需要IE9,Firefox 3,Safari 3和Opera 10兼容性(任何Chrome都可以):
background-color: rgba(0, 0, 0, 0); /* Black but completely transparent */
...仅使背景色透明-文本,边框等保持稳定。 整个元素将是可单击的。
4)如果您需要透明的背景,与旧版浏览器的“完全”兼容性以及边框或文本内容:
background-image: url("1-pixel-transparent.gif");
...其中1-pixel-transparent.gif是它所说的。
在您的情况下,可能的选择可能是“否”。 4。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.