显示下一层时,带有超链接的下层(z-index)将被禁用(html) [英] lower layer (z-index) with hyperlink becomes disabled when next layer is displayed (html)

查看:636
本文介绍了显示下一层时,带有超链接的下层(z-index)将被禁用(html)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


可能重复:

点击更高的z-index div下面的链接

我有两个div,一个最初是通过css隐藏的。当点击一个按钮时,jquery会激活,显示第一个div顶部的第二个div。第一个div仍然可见,特别是超链接,这是我想要的。但是,超链接将被禁用,单击它将没有用。

I have two divs, one is initially hidden via css. When a button is clicked a jquery fires up showing the 2nd div on top of the 1st div. The 1st div is still visible especially the hyperlink, which is what i wanted. However, the hyperlink becomes disabled and clicking it would do no good.

这是我的代码:

<button id="clickMe">Click></button>

<div class="div1">
   <a href="external.html">Load</a>
</div>   

<div class="div2">
   <p>This shows when button is clicked</p>
</div>

这是我的jquery

this is my jquery

$('#clickMe').click(function(){
  $('#div2').show();
});

div1有一个 z-index:-1;

超链接仍然可见,但我无法点击它。是否可以在不显示整个div1的情况下进行此可点击?非常感谢。

The hyperlink is still visible but i cannot click on it. Is it possible to make this clickable without showing the entire div1? many thanks.

推荐答案

另一层(透明背景)覆盖它。你无法点击下面的元素,除非你愿意尝试一些JavaScript hack,如相关问题所述:

Another layer (with transparent background) is covering it. There is no way you can click on the elements below, unless you are willing to try some JavaScript hack as described in this related question(s):

  • Passing mouse clicks through an overlaying element <div>

这篇关于显示下一层时,带有超链接的下层(z-index)将被禁用(html)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆