如何脱掉y溢出?

时间:2017-12-20 20:19:12

标签: javascript jquery

我正在尝试构建一个垂直制表符系统。我还有几个问题,但我遇到问题而没有溢出y位置。

我相信我对内容部分的表现不佳。

<button class="button">A</button>
<button class="button">B</button>
<button class="button">C</button>
<button class="button">D</button>
<button class="button">E</button>
<button class="button">F</button>
<button class="button">G</button>
<button class="button">H</button>
<button class="button">I</button>
<button class="button">J</button>
<button class="button">K</button>
<button class="button">L</button>
<button class="button">M</button>

&#13;
&#13;
     <div class="content">
<h3 class="heading">Tab 4 Content</h3>
<p class="description">Lorem cumque.</p>
&#13;
// ----------------- Variables

wrapper = $(".tabs");
tabs = wrapper.find(".nav-tab");
tabToggle = wrapper.find(".tab-toggle");

// ----------------- Functions

function openTab() {
  var content = $(this).parent().next(".content"),
    activeItems = wrapper.find(".active");

  if (!$(this).hasClass('active')) {
    $(this).add(content).add(activeItems).toggleClass('active');
    wrapper.css('min-height', content.outerHeight());
  }
};

// ----------------- Interactions

tabToggle.on('click', openTab);

// ----------------- Constructor functions

$(window).load(function() {
  tabToggle.first().trigger('click');
});
&#13;
button,
.button {
  position: relative;
  display: inline-block;
  color: white;
  padding: 0.75rem 2rem;
  margin: 0 auto;
  background-color: #374d72;
  border: none;
  width: 100%;
  font-weight: bold;
  font-size: 1.2rem;
  text-align: center;
  -webkit-transition: all 0.3s;
  -moz-transition: all 0.3s;
  transition: all 0.3s;
}

button:hover,
.button:hover {
  background-color: #374d72;
}

button:hover:before,
button:hover:after,
.button:hover:before,
.button:hover:after {
  color: #4cc4cf;
}

button:after,
button:before,
.button:after,
.button:before {
  -webkit-transition: all 0.3s;
  -moz-transition: all 0.3s;
  transition: all 0.3s;
}


/* ---------------------- Vertical Tabs */

.tabs {
  position: relative;
  min-height: 0;
  -webkit-transition: all 0.5s;
  -moz-transition: all 0.5s;
  transition: all 0.5s;
  /* ---------------------- Tab */
  /* ---------------------- Content */
}

.tabs .nav-tab {
  margin-bottom: 1px;
  /* ---------------------- Tab Toggle */
}

@media screen and (min-width: 10rem) {
  .tabs .nav-tab {
    float: left;
    clear: left;
    width: 30%;
  }
}

.tabs .nav-tab .tab-toggle {
  padding: 1rem 4rem 1rem 2rem;
  position: relative;
  outline: none;
  width: 100%;
}

@media screen and (min-width: 10rem) {
  .tabs .nav-tab .tab-toggle {
    text-align: left;
  }
}

.tabs .nav-tab .tab-toggle:after {
  content: "\25BC";
  position: absolute;
  display: block;
  right: 2rem;
  top: 50%;
  -webkit-transform: rotate(0deg) translateY(-50%);
  -moz-transform: rotate(0deg) translateY(-50%);
  -ms-transform: rotate(0deg) translateY(-50%);
  -o-transform: rotate(0deg) translateY(-50%);
  transform: rotate(0deg) translateY(-50%);
}

@media screen and (min-width: 10rem) {
  .tabs .nav-tab .tab-toggle:after {
    -webkit-transform: rotate(-90deg) translateX(50%);
    -moz-transform: rotate(-90deg) translateX(50%);
    -ms-transform: rotate(-90deg) translateX(50%);
    -o-transform: rotate(-90deg) translateX(50%);
    transform: rotate(-90deg) translateX(50%);
  }
}

.tabs .nav-tab .tab-toggle.active {
  color: #8099c2;
  background-color: white;
  cursor: default;
}

.tabs .nav-tab .tab-toggle.active:after {
  color: #8099c2;
  -webkit-transform: rotate(180deg) translateY(50%);
  -moz-transform: rotate(180deg) translateY(50%);
  -ms-transform: rotate(180deg) translateY(50%);
  -o-transform: rotate(180deg) translateY(50%);
  transform: rotate(180deg) translateY(50%);
}

@media screen and (min-width: 10rem) {
  .tabs .nav-tab .tab-toggle.active:after {
    -webkit-transform: rotate(-90deg) translateX(50%) translateY(0);
    -moz-transform: rotate(-90deg) translateX(50%) translateY(0);
    -ms-transform: rotate(-90deg) translateX(50%) translateY(0);
    -o-transform: rotate(-90deg) translateX(50%) translateY(0);
    transform: rotate(-90deg) translateX(50%) translateY(0);
    right: 1rem;
  }
}

.tabs .content {
  max-height: 0;
  overflow: hidden;
  background-color: #efefef;
}

@media screen and (min-width: 10rem) {
  .tabs .content {
    max-height: none;
    position: absolute;
    right: 0;
    top: 0;
    width: 70%;
    opacity: 0;
    padding: 0rem 2rem 2rem 2rem;
    -webkit-transform: translateX(100%);
    -moz-transform: translateX(100%);
    -ms-transform: translateX(100%);
    -o-transform: translateX(100%);
    transform: translateX(100%);
  }
}

.tabs .content.active {
  max-height: 1000px;
}

@media screen and (min-width: 10rem) {
  .tabs .content.active {
    max-height: none;
    opacity: 1;
    -webkit-transform: none;
    -moz-transform: none;
    -ms-transform: none;
    -o-transform: none;
    transform: none;
  }
}

.tabs .content>.heading {
  font-size: 1.5rem;
  margin-bottom: 1rem;
}
&#13;
&#13;
&#13;

我把它全宽,但不要让它溢出

0 个答案:

没有答案