隐藏的css溢出不符合z-index的规则 [英] css overflow hidden does not conform to the rules of z-index

查看:72
本文介绍了隐藏的css溢出不符合z-index的规则的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对div位置有一个问题.

I have one problem about div positions.

我已经创建了该 DEMO .如果单击演示,您将看到3张图片.当您将鼠标悬停在图像上方时,气泡div将打开.但这并没有显示我在外面.

I have created this DEMO. If you click the demo you can see there are 3 image. When you mause hover over the image then bubble div will open. but it is not shows me outside.

.bubble 
{
    position: absolute;
    width: 345px;
    height: auto;
    padding: 3px;
    background: #FFFFFF;
    -webkit-border-radius: 2px;
    -moz-border-radius: 2px;
    border-radius: 2px;
    border: #d8dbdf solid 1px;
    -webkit-box-shadow: -1px 1px 1px 0px rgba(216, 219, 223, 0.52);
    -moz-box-shadow:    -1px 1px 1px 0px rgba(216, 219, 223, 0.52);
    box-shadow:         -1px 1px 1px 0px rgba(216, 219, 223, 0.52);
    display:none;
    margin-left:-345px;
}

.bubble:after 
{
    content: '';
    position: absolute;
    border-style: solid;
    border-width: 10px 0 10px 10px;
    border-color: transparent #fff;
    display: block;
    width: 0;
    z-index: 1;
    right: -10px;
    top: 16px;
}

推荐答案

问题是隐藏的溢出不符合Z-index的规则.框外所有隐藏的东西都被认为是文档之外的东西.您需要找到一种满足您要求的方法.

Problem is that overflow hidden does not conform to the rules of Z-index. ANYTHING outside of the box that is hidden is assumed to be outside of the document. You need to find a way that satisfies your ability to do that.

子元素不能显示在父overflow:hidden

$('#members-bio').bxSlider({
  slideWidth: 300,
  minSlides: 2,
  maxSlides: 2,
  slideMargin: 10
});
$(document).ready(function() {
  $('figure').click(function() {
    var memberDetails = $(".member-details"),
      item = $(this),
      listLeft = (item.offset().left) + 60;
    memberDetails.offset({
      left: listLeft
    }).addClass('active-member');
  });
});

figure {
  margin: 0;
}
.member {
  position: absolute;
  top: 50px;
  left: 50%;
  width: 150px;
  height: 250px;
  margin-left: -75px;
  background: red;
  z-index: 9999;
}
.member-details {
  background-color: #fff;
  border: 1px solid #333;
  width: 140px;
  position: absolute;
  top: 150px;
  opacity: 0;
  display: none;
}
.active-member {
  display: block;
  opacity: 1;
}

<div id="members-div">
  <ul id="members-bio">
    <li class="slide">
      <figure>
        <img src="http://placehold.it/350x150&text=product">
      </figure>
    </li>
    <li class="slide">
      <figure>
        <img src="http://placehold.it/350x150&text=product">
      </figure>
    </li>
    <li class="slide">
      <figure>
        <img src="http://placehold.it/350x150&text=product">
      </figure>
    </li>
    <li class="slide">
      <figure>
        <img src="http://placehold.it/350x150&text=product">
      </figure>
    </li>
    <li class="slide">
      <figure>
        <img src="http://placehold.it/350x150&text=product">
      </figure>
    </li>
    <li class="slide">
      <figure>
        <img src="http://placehold.it/350x150&text=product">
      </figure>
    </li>
    <li class="slide">
      <figure>
        <img src="http://placehold.it/350x150&text=product">
      </figure>
    </li>
    <li class="slide">
      <figure>
        <img src="http://placehold.it/350x150&text=product">
      </figure>
    </li>
    <li class="slide">
      <figure>
        <img src="http://placehold.it/350x150&text=product">
      </figure>
    </li>
    <li class="slide">
      <figure>
        <img src="http://placehold.it/350x150&text=product">
      </figure>
    </li>
  </ul>
  <div class="member-details">
    <p>Product name</p>
    <p>Product details</p>
    <p>buy now</p>
  </div>
</div>

这篇关于隐藏的css溢出不符合z-index的规则的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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