如何在Shopify视差主题中修复手风琴与页脚重叠的问题?

时间:2019-04-05 00:47:34

标签: javascript css shopify accordion footer

折叠时,我的手风琴与页脚重叠。如何使手风琴折叠并且不与页脚重叠时扩展页面? (Shopify视差主题)

我尝试在页脚和手风琴CSS上以及位置上添加display块:相对在我的页脚CSS上但没有运气。

.accordion {
  background-color:white;
  color:#444;
  cursor: pointer;
  padding: 18px;
  width: 100%;
  text-align: left;
  border-bottom: 1px solid black;
  outline: none;
  transition: 0.4s;
}


.accordion:hover {
  background-color: #ccc;
}


.panel {
  padding: 0 18px;
  background-color: white;
  display: none;
  overflow: auto;
}

.accordion:after {
  content: '\FF0B'; /* Unicode character for "plus" sign (+) */
  font-size: 20px;
  color: #777;
  float: right;
  margin-left: 5px;
}

.active:after {
  content: "\2212"; /* Unicode character for "minus" sign (-) */
  font-size:20px;
}

''''

 .footer {
    margin-top: 0;
    padding: 0;
    background-color: {{ settings.sub_footer_color }};
    color: {{ settings.sub_footer_text_color }};
    {% if settings.custom_footer %}
      background-image: url("{{ settings.custom_footer | img_url: '2000x' }}");
      {% if settings.footer_bg_stretched %}
        background-repeat:no-repeat;
        background-attachment:fixed;
        -webkit-background-size:cover;
        -moz-background-size:cover;
        -o-background-size:cover;
        background-size:cover;
      {% else %}
        background-repeat:{{ settings.footer_repeat_bg }};
      {% endif %}
    {% endif %}
        }

''''

<div id="navigation">
<input type="hidden" name="demo2" />
<script type="text/javascript">
var acc = document.getElementsByClassName("accordion");
var i;

for (i = 0; i < acc.length; i++) {
  acc[i].addEventListener("click", function() {
    /* Toggle between adding and removing the "active" class,
    to highlight the button that controls the panel */
    this.classList.toggle("active");

    /* Toggle between hiding and showing the active panel */
    var panel = this.nextElementSibling;
    if (panel.style.display === "block") {
      panel.style.display = "none";
    } else {
      panel.style.display = "block";
    }
  });
}

0 个答案:

没有答案