[英]How to make this an entirely clickable DIV
I'm using JQuery to hide a DIV when the following DIV is clicked 单击以下DIV时,我正在使用JQuery隐藏DIV
.up_link {
position: absolute;
width: 830px;
height: 500px;
z-index: 8;
text-align: center;
cursor: pointer;
border: 3px solid #000;
}
which works fine in Firefox but not in IE. 在Firefox中可以正常工作,但在IE中则不能。 I can click the whole DIV in Firefox but in IE, only the border.
我可以在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 HTML
<div class="gallery_block2">
<div class="gallery_thumbs">
<div class="gallery_close_container up_link"></div>
<div class="load_space"></div>
</div>
</div>
Any help is appreciated. 任何帮助表示赞赏。
Likely problem: An element with no background (or background-color: transparent
) will not trigger click events in IE (6-8 at least, not sure about 9) when clicking that (non-)background. 可能的问题:没有背景(或
background-color: transparent
)的元素在单击(非)背景时不会触发IE中的单击事件(至少6-8,不确定9)。
Workarounds: 解决方法:
1) If you don't need transparent background: 1)如果您不需要透明背景:
background-color: #000000; /* Color of whatever's behind the <div> */
2) If you don't need the border or any text content: 2)如果您不需要边框或任何文本内容:
background-color: #000000;
filter: alpha(opacity = 0);
opacity: 0;
/* And vendor prefixes for older browsers, e.g. -moz-opacity */
... makes the entire element transparent, but clickable. ...使整个元素透明,但可单击。
3) If you only need IE9, Firefox 3, Safari 3 and Opera 10 compatibility (any Chrome goes): 3)如果您只需要IE9,Firefox 3,Safari 3和Opera 10兼容性(任何Chrome都可以):
background-color: rgba(0, 0, 0, 0); /* Black but completely transparent */
... makes only the background color transparent - text, border etc. remains solid. ...仅使背景色透明-文本,边框等保持稳定。 The entire element will be clickable.
整个元素将是可单击的。
4) If you need transparent background, "full" compatibility with older browsers, and borders or text content: 4)如果您需要透明的背景,与旧版浏览器的“完全”兼容性以及边框或文本内容:
background-image: url("1-pixel-transparent.gif");
... where 1-pixel-transparent.gif is what it says it is. ...其中1-pixel-transparent.gif是它所说的。
In your case, the likely option would probably be no. 在您的情况下,可能的选择可能是“否”。 4.
4。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.