使用变换比例的 Z 索引问题



我在下面有一个代码笔。基本上,我试图在悬停在突出显示的圆圈(红色)上显示一个弹出窗口,但是一些突出显示的圆圈显示在某些弹出窗口上方,即使弹出窗口始终具有更高的 z 指数。

http://codepen.io/Wolfmans55/pen/jPwKqZ

这是用于弹出窗口的动画,我相信这可能是罪魁祸首。

@-webkit-keyframes popup {
 0% {
    transform: scale(2.5);
  }
  100% {
    transform: scale(0);
  }
}

去掉 .white-popup 上的 z-index 设置,并在 .white-popup:hover .popup 和 .white:hover 上设置更高的 z 索引。见JSFIDDLE

    @import url(http://fonts.googleapis.com/css?family=Roboto);
body,
html {
  height: 100%;
}
body {
  background: #343837;
  transition: opacity .25s;
  -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
  overflow: hidden;
}
.show-body {
  opacity: 1;
  -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)";
}
.page {
  background: #343837;
  font-family: 'Roboto', sans-serif;
  font-size: 100%;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transition: all 1s;
}
.page-2 {
  left: auto;
  right: -100%;
  background: blue;
}
.prev-page,
.next-page {
  position: absolute;
  top: 50%;
  width: 50px;
  height: 50px;
  background: red;
}
.next-page {
  right: 20px;
}
.prev-page {
  left: 20px;
}
.page-wrapper {
  position: absolute;
  top: 50%;
  margin-top: -303px;
  width: 100%;
}
.header_section {
  text-shadow: 1px 1px 1px #000;
  font-size: 2em;
}
h1 {
  margin: 0;
}
.blue_title {
  color: #54c8e7;
  font-weight: normal;
}
.primary_title {
  font-size: 4em;
  margin-top: -34px;
  margin-bottom: 20px;
}
.sub_title {
  position: relative;
  font-size: 1em;
  background: #343837;
  padding: 0 4px;
  display: inline-block;
}
.sub_title_divider {
  border-top: 1px solid #54c8e7;;
  position: absolute;
  top: 20px;
  left: 0;
  width: 100%;
}
.city-name {
  font-size: 2em;
}
.emphasis {
  font-weight: bold;
}
.inlineblock {
  display: inline-block;
}
.centertxt {
  text-align: center;
}
.pos_rel {
  position: relative;
}
.overflow_hidden {
  overflow: hidden;
}
.vert_mid {
  vertical-align: middle;
}
table { 
  cursor: pointer;
  margin: 0 auto;
  border-spacing: 1px;
} 
td {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.white,
.white-popup {
  background: #000;
  position: relative;
  -webkit-animation: in .25s;
}
.white-popup {
  background: red;
}
/*.plan-to {
  background: #018c9e;
  z-index: 2;
}*/
.white-popup .popup {
  cursor: auto;
  -webkit-animation: popup .25s forwards;
  z-index: 10;
}
.popup {
  position: absolute;
  width: 100px;
  height: 100px;
  font-size: 5px;
  overflow: hidden;
  background: #54c8e7;
  z-index:10;
  top: -45px;
  left: -45px;
  padding: 8px;
  border: 1px solid #343837;
  border-radius: 3px;
  box-sizing: border-box;
}
.white-popup:hover .popup { 
  -webkit-animation: out .25s forwards;
    z-index: 50;
}
.white:hover {
  -webkit-animation: out .25s forwards;
    z-index: 50;
}
@-webkit-keyframes in {
    from {background:#fff; transform: scale(1);}
    to {background: #54c8e7; transform: scale(2.5);}
}
@-webkit-keyframes out {
    0% {background:#fff; transform: scale(1);}
    100% {background: #54c8e7; transform: scale(2.5);}
}
@-webkit-keyframes popup {
  0% {
    transform: scale(2.5);
  }
  100% {
    transform: scale(0);
  }
}

.key {
  height: 15px;
  width: 15px;
   border-radius: 50%; 
  border: 1px solid #ccc;
  margin-right: 2px;
}
.key_1 {
  background: #54c8e7;
}
.key_2 {
  background: #018c9e;
}
.key_3 {
  background: #fff;
}
.legend {
  text-transform:uppercase;
  font-size: 12px;
  color: #fff;
  margin-bottom: 30px;
}
.legend_item {
  margin-left: 15px;
}
@media screen and (min-width: 768px) {
  .page-wrapper {
    margin-top: -388px;
  }
  td {
    width: 15px;
    height: 15px;
  }
}

我添加了以下CSS:

td:hover {
    z-index: 1;
}

在选择器.white-popup,我删除了:

z-index: 2;

线。

似乎对我有用。

最新更新