Кнопка не закрывается?



Вот мой кодовый ключ: http://codepen.io/Chiz/pen/MaBwBb



Когда вы нажимаете на кнопки, обычно кнопка дает визуальную обратную связь о том, что она" нажата", но в этом случае ничего подобного не происходит. Как будто кнопки были отключены. Почему это так?




$(document).ready(function() {
$("#fullpage").fullpage({
verticalCentered: false,
resize: true,
scrollingSpeed: 700,
css3: true,
easing: "easeOutBounce"
});
});

* {
box-sizing: border-box;
}
html,
body {
height: 100%;
}
div.container {
position: relative;
}
#fullpage {
width: 100%;
height: 100%;
background-color: #ffe4b3;
}
#header {
width: 100%;
height: 70px;
line-height: 70px;
background-color: #343434;
}
#header ul {
list-style-type: none;
color: white;
margin: 0;
height: 100%;
}
#header ul li {
display: inline-block;
float: right;
padding: 0rem 2rem;
width: 10rem;
height: 100%;
text-align: center;
font-size: 1rem;
}
#header ul li a {
color: white;
text-decoration: none;
}
#footer {
width: 100%;
height: 50px;
position: absolute;
bottom: 0px;
background-color: black;
}
.slide {
font-size: 1.5rem;
}
.button-container {
position: absolute;
left: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
.prev,
.next {
width: 7rem;
height: 3rem;
font-size: 1rem;
}

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>
<script src="https:https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js"></script>
<script src="https:https://cdnjs.cloudflare.com/ajax/libs/fullPage.js/2.7.4/jquery.fullPage.min.js"></script>
<script src="https:https://cdnjs.cloudflare.com/ajax/libs/fullPage.js/2.7.4/vendors/jquery.slimscroll.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/fullPage.js/2.7.4/jquery.fullPage.min.css" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/normalize/3.0.3/normalize.min.css" />



<div id="fullpage">
<div class="section active container">
<div id="header">
<ul>
<li><a href="">Link 1</a>
</li>
<li><a href="">Link 2</a>
</li>
<li><a href="">Link 3</a>
</li>
</ul>
</div>
<div class="slide">Slide1</div>
<div class="slide">Slide2</div>
<div class="slide">Slide3</div>

<div class="button-container">
<button type="button" class="prev">Prev</button>
<button type="button" class="next">Next</button>
</div>

<div id="footer"></div>
</div>
</div>
541   2  

2 ответов:

Из-за того, как вы размещаете элементы, часть порядка стека отсутствует, и поэтому события щелчка слайдов фактически происходят поверх этих 2 кнопок.

Попробуйте добавить z-index: 999;, и вы увидите, что функциональность, которую вы ожидаете, возвращается.

Пример CodePen

$(document).ready(function() {
  $("#fullpage").fullpage({
    verticalCentered: false,
    resize: true,
    scrollingSpeed: 700,
    css3: true,
    easing: "easeOutBounce"
  });
});
* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
div.container {
  position: relative;
}
#fullpage {
  width: 100%;
  height: 100%;
  background-color: #ffe4b3;
}
#header {
  width: 100%;
  height: 70px;
  line-height: 70px;
  background-color: #343434;
}
#header ul {
  list-style-type: none;
  color: white;
  margin: 0;
  height: 100%;
}
#header ul li {
  display: inline-block;
  float: right;
  padding: 0rem 2rem;
  width: 10rem;
  height: 100%;
  text-align: center;
  font-size: 1rem;
}
#header ul li a {
  color: white;
  text-decoration: none;
}
#footer {
  width: 100%;
  height: 50px;
  position: absolute;
  bottom: 0px;
  background-color: black;
}
.slide {
  font-size: 1.5rem;
}
.button-container {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 999;
}
.prev,
.next {
  width: 7rem;
  height: 3rem;
  font-size: 1rem;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>
<script src="https:https://cdnjs.cloudflare.com/ajax/libs/jquery-easing/1.3/jquery.easing.min.js"></script>
<script src="https:https://cdnjs.cloudflare.com/ajax/libs/fullPage.js/2.7.4/jquery.fullPage.min.js"></script>
<script src="https:https://cdnjs.cloudflare.com/ajax/libs/fullPage.js/2.7.4/vendors/jquery.slimscroll.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/fullPage.js/2.7.4/jquery.fullPage.min.css" />
<link href="https://cdnjs.cloudflare.com/ajax/libs/normalize/3.0.3/normalize.min.css" />



<div id="fullpage">
  <div class="section active container">
    <div id="header">
      <ul>
        <li><a href="">Link 1</a>
        </li>
        <li><a href="">Link 2</a>
        </li>
        <li><a href="">Link 3</a>
        </li>
      </ul>
    </div>
    <div class="slide">Slide1</div>
    <div class="slide">Slide2</div>
    <div class="slide">Slide3</div>

    <div class="button-container">
      <button type="button" class="prev">Prev</button>
      <button type="button" class="next">Next</button>
    </div>

    <div id="footer"></div>
  </div>
</div>

У вас есть .button-container под .fp-slides. Применить z-index Для .button-container большего, чем z-index из .fp-slides

Comments

    Ничего не найдено.