gpt4 book ai didi

html - 折叠时展开按钮消失

转载 作者:行者123 更新时间:2023-11-28 14:19:10 26 4
gpt4 key购买 nike

我有下面的代码,每一行都有一个按钮,它执行两个功能,它们是展开和折叠按钮所在的特定行。

<div class="">
<ul>
<li
ng-repeat="nav in ciRelationshipHierarchyBySection track by $index"
style="background:none; padding:0 10px;margin:5px;"
class="nav nav-list panel-collapse collapse in"
id="networkDevicesCollapsePanel_{{$index}}"
>
<div
ng-show="ciAttributesCount"
id="collapsebutton_{{$index}}"
data-toggle="collapse"
data-target="#networkDevicesCollapsePanel_{{$index}}"
class="nodisp expandcollapse no-print">
<i class="glyphicon glyphicon-minus"></i>Collapse/expand
</div>
<a
style="cursor:pointer; padding: 2px 12px;"
ng-click="showNetworkDevices(nav.IdentificationSourceId)">
{{nav.IdentifySourceName}}
</a>
<span style="padding: 2px 12px;">Source Id: {{nav.IdentificationSourceId}}</span>
<br />
<span style="padding: 2px 12px;">Data Source: {{nav.DataSource}}</span>
<br />
<span style="padding: 2px 12px;">Create New: {{nav.IsCreateNew}}</span>
<br />
</li>
</ul>
</div>

我的问题是,由于按钮位于同一行,按钮也会折叠并且无法展开。

如何解决这个问题?

按钮点击事件如下所示:

$("#expandbutton1").hide();

$("#expandbutton1").click(function () {
$('#networkDevicesLinks div.panel-collapse').addClass('in').css("height", "");
$("#expandbutton1").hide();
$("#collapsebutton1").show();

$('a[data-toggle="collapse"]').each(function (index) {
$(this).find("i").removeClass("fa-plus-square-o").addClass("fa-minus-square-o");
});
});

$("#collapsebutton1").click(function () {
$('#networkDevicesLinks div.panel-collapse').removeClass('in');
$("#expandbutton1").show();
$("#collapsebutton1").hide();

$('a[data-toggle="collapse"]').each(function (index) {
$(this).find("i").removeClass("fa-minus-square-o").addClass("fa-plus-square-o");
});
});
});

最佳答案

考虑将可折叠面板插入 li 标记的内部子项中:

<ul>
<!-- remove anything make the li collapsible -->
<li
ng-repeat="nav in ciRelationshipHierarchyBySection track by $index"
style="background:none; padding:0 10px;margin:5px;"
class="nav nav-list"
>
<div
ng-show="ciAttributesCount"
id="collapsebutton_{{$index}}"
data-toggle="collapse"
data-target="#networkDevicesCollapsePanel_{{$index}}"
class="nodisp expandcollapse no-print">
<i class="glyphicon glyphicon-minus"></i>Collapse/expand
</div>
<!-- new collapsible tag inside the li -->
<div
class="panel-collapse collapse in"
id="networkDevicesCollapsePanel_{{$index}}"
>
<a
style="cursor:pointer; padding: 2px 12px;"
ng-click="showNetworkDevices(nav.IdentificationSourceId)">
{{nav.IdentifySourceName}}
</a>
<span style="padding: 2px 12px;">Source Id: {{nav.IdentificationSourceId}}</span>
<br />
<span style="padding: 2px 12px;">Data Source: {{nav.DataSource}}</span>
<br />
<span style="padding: 2px 12px;">Create New: {{nav.IsCreateNew}}</span>
<br />
</div>
</li>
</ul>

关于html - 折叠时展开按钮消失,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55413627/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com