第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

用于關閉所有可折疊元素的引導按鈕

用于關閉所有可折疊元素的引導按鈕

慕絲7291255 2022-07-15 09:40:44
我的 HTML 文件中有以下代碼:<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"><div class="list-group list-group-flush">  <a href="javascript: void(0)" data-parent=".list-group" class="list-group-item list-group-item-action filter-options" data-group="all"><b>Home</b></a>  <a data-toggle="collapse" href="#itSection" class="list-group-item list-group-item-action"><b>IT</b></a>  <div id="itSection" class="list-group collapse">    <a href="javascript: void(0)" class="list-group-item list-group-item-action menu2 filter-options" data-group="devops">DevOps</a>  </div>  <a data-toggle="collapse" href="#pdSection" class="list-group-item list-group-item-action"><b>Product                    Development</b></a>  <div id="pdSection" class="list-group collapse">    <a href="javascript: void(0)" class="list-group-item list-group-item-action menu2 filter-options" data-group="travelandcppd">Travel &                    CP</a>    <a href="javascript: void(0)" class="list-group-item list-group-item-action menu2 filter-options" data-group="sfandcppd">SF &                    CP</a>  </div>  <a href="javascript: void(0)" class="list-group-item list-group-item-action filter-options" data-group="management"><b>Management</b></a>  <a href="javascript: void(0)" class="list-group-item list-group-item-action filter-options" data-group="marketing"><b>Marketing</b></a></div><script src="https://code.jquery.com/jquery-3.4.1.slim.min.js"></script><script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"></script><script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>正如您在代碼中看到的,我有幾個帶有子菜單的部分。如果單擊主頁,我正在嘗試使用 data-parent 屬性折疊所有展開的項目。你能在這里指出我正確的方向嗎?
查看完整描述

3 回答

?
慕森王

TA貢獻1777條經(jīng)驗 獲得超3個贊

我的 HTML 文件中有以下代碼:


<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">


<div class="list-group list-group-flush">

  <a href="javascript: void(0)" data-parent=".list-group" class="list-group-item list-group-item-action filter-options" data-group="all"><b>Home</b></a>

  <a data-toggle="collapse" href="#itSection" class="list-group-item list-group-item-action"><b>IT</b></a>

  <div id="itSection" class="list-group collapse">

    <a href="javascript: void(0)" class="list-group-item list-group-item-action menu2 filter-options" data-group="devops">DevOps</a>

  </div>

  <a data-toggle="collapse" href="#pdSection" class="list-group-item list-group-item-action"><b>Product

                    Development</b></a>

  <div id="pdSection" class="list-group collapse">

    <a href="javascript: void(0)" class="list-group-item list-group-item-action menu2 filter-options" data-group="travelandcppd">Travel &

                    CP</a>

    <a href="javascript: void(0)" class="list-group-item list-group-item-action menu2 filter-options" data-group="sfandcppd">SF &

                    CP</a>

  </div>

  <a href="javascript: void(0)" class="list-group-item list-group-item-action filter-options" data-group="management"><b>Management</b></a>

  <a href="javascript: void(0)" class="list-group-item list-group-item-action filter-options" data-group="marketing"><b>Marketing</b></a>

</div>


<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js"></script>

<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"></script>

<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>


正如您在代碼中看到的,我有幾個帶有子菜單的部分。


如果單擊主頁,我正在嘗試使用 data-parent 屬性折疊所有展開的項目。你能在這里指出我正確的方向嗎?

演示:https ://codeply.com/p/t0Pb45zkuI


查看完整回答
反對 回復 2022-07-15
?
UYOU

TA貢獻1878條經(jīng)驗 獲得超4個贊

添加以下腳本


$("a[data-toggle='collapse']").click(() => {

    $(".collapse").removeClass('show');

});

$("a[data-toggle='collapse']").click(() => {

  $(".collapse").removeClass('show');

});

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">


<div class="list-group list-group-flush">

  <a href="javascript: void(0)" data-parent=".list-group" class="list-group-item list-group-item-action filter-options" data-group="all"><b>Home</b></a>

  <a data-toggle="collapse" href="#itSection" class="list-group-item list-group-item-action"><b>IT</b></a>

  <div id="itSection" class="list-group collapse">

    <a href="javascript: void(0)" class="list-group-item list-group-item-action menu2 filter-options" data-group="devops">DevOps</a>

  </div>

  <a data-toggle="collapse" href="#pdSection" class="list-group-item list-group-item-action"><b>Product

                    Development</b></a>

  <div id="pdSection" class="list-group collapse">

    <a href="javascript: void(0)" class="list-group-item list-group-item-action menu2 filter-options" data-group="travelandcppd">Travel &

                    CP</a>

    <a href="javascript: void(0)" class="list-group-item list-group-item-action menu2 filter-options" data-group="sfandcppd">SF &

                    CP</a>

  </div>

  <a href="javascript: void(0)" class="list-group-item list-group-item-action filter-options" data-group="management"><b>Management</b></a>

  <a href="javascript: void(0)" class="list-group-item list-group-item-action filter-options" data-group="marketing"><b>Marketing</b></a>

</div>


<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js"></script>

<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"></script>

<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>



查看完整回答
反對 回復 2022-07-15
?
慕妹3242003

TA貢獻1824條經(jīng)驗 獲得超6個贊

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">


<div class="list-group list-group-flush">

  <a href="javascript: void(0)" data-parent=".list-group" class="list-group-item list-group-item-action filter-options" data-group="all"><b>Home</b></a>

  <a data-toggle="collapse" href="#itSection" class="list-group-item list-group-item-action"><b>IT</b></a>

  <div id="itSection" class="list-group collapse">

    <a href="javascript: void(0)" class="list-group-item list-group-item-action menu2 filter-options" data-group="devops">DevOps</a>

  </div>

  <a data-toggle="collapse" href="#pdSection" class="list-group-item list-group-item-action"><b>Product

                    Development</b></a>

  <div id="pdSection" class="list-group collapse">

    <a href="javascript: void(0)" class="list-group-item list-group-item-action menu2 filter-options" data-group="travelandcppd">Travel &

                    CP</a>

    <a href="javascript: void(0)" class="list-group-item list-group-item-action menu2 filter-options" data-group="sfandcppd">SF &

                    CP</a>

  </div>

  <a href="javascript: void(0)" class="list-group-item list-group-item-action filter-options" data-group="management"><b>Management</b></a>

  <a href="javascript: void(0)" class="list-group-item list-group-item-action filter-options" data-group="marketing"><b>Marketing</b></a>

</div>


<script src="https://code.jquery.com/jquery-3.4.1.slim.min.js"></script>

<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js"></script>

<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>

<script>

   $("a[data-parent=\".list-group\"]").click(() => {

        $("div.collapse").removeClass("show");

        //your eextra code here

    });

</script>


查看完整回答
反對 回復 2022-07-15
  • 3 回答
  • 0 關注
  • 162 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網(wǎng)微信公眾號