为了hide/show
在您的页面上添加元素,您需要使用像 javascript 这样的客户端脚本。这是一个简单的 javascript 函数,用于在您的数组showing
之间切换。hiding
在<head>
您的 html 中添加以下脚本/函数-
<script type="text/javascript">
function toggleView(aid, id, text) {
var divView = document.getElementById(id);
var anchor = document.getElementByID(aid);
if (divView.style.display != "block") {
divView.style.display = "block";
anchor.innerHTML = "click here to hide " + text + " options";
} else {
divView.style.display = "none";
anchor.innerHTML = "click here to show " + text + " options";
}
}
</script>
然后在你的<body>
你会创建一个<a>
锚点,和一个<div>
您的锚标记和 div 将如下所示:
<a id="toggle3" onclick="toggleView('toggle3', 'options3', 'first 3')">click here to show first 3 options</a>
<div id="options3" style="display: none">
Option 1
Option 2
Option 3
</div>
<a id="toggle4" onclick="toggleView('toggle4', 'options4', 'last 4')">click here to show last 4 options</a>
<div id="options4" style="display: none">
Option 4
Option 5
Option 6
Option 7
</div>
11/30 编辑
这是我的做法 -
Javascript
On line #438 of admin-interface.php
, 在<?php }
添加 javascript之前function()
<?php
//Hide/Show Image Groups
?>
<script type="text/javascript">
function toggleView(aid, id, text) {
var divView = document.getElementById(id);
var anchor = document.getElementByID(aid);
if (divView.style.display != "block") {
divView.style.display = "block";
anchor.innerHTML = "click here to hide " + text + " options";
} else {
divView.style.display = "none";
anchor.innerHTML = "click here to show " + text + " options";
}
}
</script>
Anchor/DIV
在第 #603 行admin-interface.php
,在//$output .= '<div class="section ...
添加anchors
and之前注意:如果您已经添加了上面的 javascript <div>
,它可能是第 #621 行而不是 #603
function()
if ($value['type'] == "images" && $counter == 1)
{$output .= '<a id="toggle3" onclick="toggleView(\'toggle3\', \'options3\', \'first 3\')">click here to show first 3 options</a>'."\n" . '<div id="options3" style="display: none">'."\n";}
if ($value['type'] == "images" && $counter == 4)
{$output .= '<a id="toggle4" onclick="toggleView(\'toggle4\', \'options4\', \'last 4\')">click here to show last 4 options</a>'."\n" . '<div id="options4" style="display: none">'."\n";}
在第 #957 行admin-interface.php
,}$output .= '</div>';return array($output,$menu);
在 #958-960 之前,添加</div>
结束标签
注意:如果您已经添加了 javascriptfunction()
和上面的anchors
and <div>
,它可能是第 #979 行而不是 #957
if ($value['type'] == "images" && ($counter == 1 || $counter == 4))
{$output .= '</div>'."\n";}