css溢出仅对y可见

时间:2017-05-10 12:38:24

标签: html css

我试图在滑块部分(y轴)上溢出工具提示。 在滑块下我有另一个带有9个元素的滑块(每个都有一个工具提示)

我希望下面的滑块宽度为1170px,包含5个元素。剩下的项目应该是隐藏的。

我的英语很差,所以我疯了很短视频24 https://vimeo.com/216830963

这是代码



section#slider {
  width: 100%;
  overflow: hidden;
  padding-top: 110px;
  padding-bottom: 0px;
  height: 482px;
}

.wrap {
  position: relative;
  margin: 3em 0;
}

/* Frame */

.frame {
  height: 130px;
  line-height: 130px;
  overflow-x: hidden;
  /*overflow: hidden !important;*/
}

.frame ul {
  list-style: none;
  margin: 0;
  padding: 0;
  height: 100%;
  font-size: 50px;
}

.frame ul li {
  float: left;
  width: 227px;
  height: 100%;
  margin: 0 2px 0 0;
  padding: 0;
  background: #f1f1f1;
  color: #00b5f6;
  text-align: center;
  cursor: pointer;
  /*border-right: 1px solid #00b5f6;*/
}

.frame ul li:hover {
  color: #fff;
  background: #00b5f6;
}


/* Scrollbar */

.scrollbar {
  margin: 0 0 1em 0;
  height: 2px;
  background: #ccc;
  line-height: 0;
}

.scrollbar .handle {
  width: 100px;
  height: 100%;
  background: #292a33;
  cursor: pointer;
}

.scrollbar .handle .mousearea {
  position: absolute;
  top: -9px;
  left: 0;
  width: 100%;
  height: 20px;
}


/* setup tooltips */

.tooltip {
  position: relative;
  overflow: visible;
}

.tooltip:before,
.tooltip:after {
  position: absolute;
  display: inline-block;
  opacity: 0;
  pointer-events: none;
  width: 225px;
  overflow: visible;
}

.tooltip:after {
  border-right: 6px solid transparent;
  border-top: 6px solid #00b5f6;
  border-left: 6px solid transparent;
  content: '';
  height: 0;
  top: -5px;
  left: 20px;
  width: 0;
}

.tooltip:before {
  background: #00b5f6;
  border-radius: 2px;
  color: #fff;
  content: attr(data-title);
  font-size: 14px;
  padding: 6px 10px;
  top: -145px;
  left: 0px;
  white-space: nowrap;
  height: 130px;
  max-width: 207px !important;
}


/* the animations */


/* expand */

.tooltip.expand:before {
  transform: scale3d(.2, .2, 1);
  transition: all .2s ease-in-out 0.5s;
}

.tooltip.expand:after {
  transform: translate3d(0, 6px, 0);
  transition: all .2s ease-in-out 0.5s;
}

.tooltip.expand:hover:before,
.tooltip.expand:hover:after {
  opacity: 1;
  transform: scale3d(1, 1, 1);
}

<section id="slider">
  <img src="http://localhost/wh1/wp-content/uploads/2016/02/si.png">
</section>


<div style="width:1170px; height:180px; margin-left:auto; margin-right:auto;">
  <div style="max-width: 100%;">

    <div class="wrap" style="margin:15px 0 15px 0; ">
      <div class="scrollbar">
        <div class="handle">
          <div class="mousearea"></div>
        </div>
      </div>

      <div class="frame" id="basic">
        <ul class="clearfix">
          <li class="tooltip expand" data-title="Text tooltip">1</li>
          <li class="tooltip expand" data-title="Text tooltip">2</li>
          <li class="tooltip expand" data-title="Text tooltip">3</li>
          <li class="tooltip expand" data-title="Text tooltip">4</li>
          <li class="tooltip expand" data-title="Text tooltip">5</li>
          <li class="tooltip expand" data-title="Text tooltip">6</li>
          <li class="tooltip expand" data-title="Text tooltip">7</li>
          <li class="tooltip expand" data-title="Text tooltip">8</li>
          <li class="tooltip expand" data-title="Text tooltip">9</li>
        </ul>
      </div>
    </div>
  </div>
</div>
&#13;
&#13;
&#13;

我不知道如何修复它。如果可以,请帮忙

由于

2 个答案:

答案 0 :(得分:0)

为#basic或.frame指定一个特定宽度,然后应用css溢出属性

答案 1 :(得分:0)

因为您希望在滚动框的顶部显示该工具提示,所以您需要在顶部的该图像滑块中包含一个新的包装器。我的意思是这样的:

Wrapper DIV

包装器必须是overflow-x: hidden;

使用这种方法,您可以使工具提示可见,并从滚动区hidden

溢出