Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/81.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/40.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 如何使它成为一个完全可点击的DIV_Jquery_Css - Fatal编程技术网

Jquery 如何使它成为一个完全可点击的DIV

Jquery 如何使它成为一个完全可点击的DIV,jquery,css,Jquery,Css,我正在使用JQuery在单击以下DIV时隐藏一个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中,只能单击边框 $(fu

我正在使用JQuery在单击以下DIV时隐藏一个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



感谢您的帮助。

可能的问题:没有背景的元素(或
背景颜色:透明的
)在IE(至少6-8,不确定9)中单击该(非)背景时不会触发单击事件

解决办法:

1) 如果不需要透明背景:

background-color: #000000; /* Color of whatever's behind the <div> */
。。。使整个元素透明,但可单击

3) 如果您只需要IE9、Firefox 3、Safari 3和Opera 10的兼容性(任何Chrome浏览器都可以):

。。。仅使背景色透明-文本、边框等保持实心。整个元素都可以单击

4) 如果您需要透明背景,则需要与旧浏览器、边框或文本内容“完全”兼容:

background-color: #000000;
filter: alpha(opacity = 0);
opacity: 0;
/* And vendor prefixes for older browsers, e.g. -moz-opacity */
background-image: url("1-pixel-transparent.gif");
。。。其中1-pixel-transparent.gif就是它所说的那样


在您的情况下,可能的选项可能是第4个。

可能的问题:没有背景的元素(或
背景颜色:透明的
)在IE中单击该(非)背景时不会触发单击事件(至少6-8次,不确定9次)

解决办法:

1) 如果不需要透明背景:

background-color: #000000; /* Color of whatever's behind the <div> */
。。。使整个元素透明,但可单击

3) 如果您只需要IE9、Firefox 3、Safari 3和Opera 10的兼容性(任何Chrome浏览器都可以):

。。。仅使背景色透明-文本、边框等保持实心。整个元素都可以单击

4) 如果您需要透明背景,则需要与旧浏览器、边框或文本内容“完全”兼容:

background-color: #000000;
filter: alpha(opacity = 0);
opacity: 0;
/* And vendor prefixes for older browsers, e.g. -moz-opacity */
background-image: url("1-pixel-transparent.gif");
。。。其中1-pixel-transparent.gif就是它所说的那样


在您的情况下,可能的选项是第4项。

您也可以发布您的javascript代码吗?我们需要查看您的JS和标记。通常使用
$('.gallery\u close\u container')很简单。单击(…)
就足够了。使用JQuery更新。您发布了一个CSS类,而不是div。我们可以查看html上下文(第页)这是哪种情况?您是否尝试在.up_link类中增加z-index?您是否也可以发布您的javascript代码?我们需要查看您的JS和标记。通常使用
$('.gallery\u close\u container')很简单。单击(…)
就足够了。用JQuery更新。您发布了一个CSS类,而不是div。我们可以看到它所在的html上下文(页面)吗?您是否尝试在.up\u链接类中增加z-index?非常棒的帮助。为了记录在案,我使用了#2.5的帮助。为了记录在案,我使用了#2。