在基于 Web 的手风琴设备中插入内容会使其停止工作



我已经设置了一个手风琴,在一个网站上显示条款和条件,直到我尝试从服务器上的其他地方拉出一个页面。

到目前为止,我的编码如下:

.CSS:

/* Accordion controls & Styles */
/* Style the buttons that are used to open and close the accordion panel */
.accordion {
background-color: #eee;
color: #444;
cursor: pointer;
padding: 18px;
width: 100%;
border: none;
text-align: left;
outline: none;
font-size: 15px;
transition: 0.4s;
}
.active, .accordion:hover {
background-color: #ccc;
}
.accordion:after {
content: '02B';
color: #777;
font-weight: bold;
float: right;
margin-left: 5px;
}
.active:after {
content: "2212";
}
.panel {
padding: 0 18px;
background-color: white;
max-height: 0;
overflow: hidden;
transition: max-height 0.2s ease-out;
}

手风琴:

<button class="accordion">Standard Terms</button>
<div class="panel">
<p>
<?php include(SHARED_PATH . '/legal/inserts/standard_terms.php'); ?>
</p>
</div>

和JavaScript:

var acc = document.getElementsByClassName("accordion");
var i;
for (i = 0; i < acc.length; i++) {
acc[i].addEventListener("click", function() {
this.classList.toggle("active");
var panel = this.nextElementSibling;
if (panel.style.maxHeight) {
panel.style.maxHeight = null;
} else {
panel.style.maxHeight = panel.scrollHeight + "px";
}
});
}

要呈现的标准条款页面:

<?php include(SHARED_PATH . '/public_header.php'); ?>
<ol>
<h3><li>What we provide</li></h3>
</ol>

<?php include(SHARED_PATH . '/public_footer.php');?>

一切都按预期工作,直到我把<?php include(SHARED_PATH . '/legal/inserts/standard_terms.php'); ?>放进去,如果我把它拿下来并放在手风琴之外,它呈现得很好并显示内容.

只有在手风琴内部,它才能阻止一切。

它不会呈现页面的其余部分,也不会引发任何错误。

有什么想法吗?

抱歉找到了答案,在发布标准条款页面后意识到我的错误。 页眉和页脚已被上一页调用。

最新更新