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

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

引導(dǎo) 4:在前循環(huán)中將一個(gè)圖標(biāo)與另一個(gè)圖標(biāo)交換的最佳方式是什么?

引導(dǎo) 4:在前循環(huán)中將一個(gè)圖標(biāo)與另一個(gè)圖標(biāo)交換的最佳方式是什么?

我想在使用折疊時(shí)交換,在使用foreach循環(huán)時(shí)沒有每個(gè)圖標(biāo)同時(shí)切換。fa fa-plusfa fa-minus這是我的代碼演示。<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" /><link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" /><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><div class="container h-100">    <div class="row no-gutters border-0 rounded align-items-center mt-3">        <div class="col-sm-4">demo 1</div>        <div class="col-sm-4">demo 1</div>        <div class="col-sm-3">demo 1</div>        <div class="col-sm-1 ">            <a class="fa fa-plus" data-toggle="collapse" href="#collapse1" aria-expanded="true" aria-controls="collapse1"></a>        </div>    </div><!--row-->    <div class="collapse" id="collapse1">        <div class="row no-gutters border-0 rounded align-items-center mt-3">            <div class="col-sm-4">demo 1</div>            <div class="col-sm-4">demo 1</div>            <div class="col-sm-4">demo 1</div>        </div><!--collapse-->    </div>    <div class="row no-gutters border-0 rounded align-items-center mt-3">        <div class="col-sm-4">demo 2</div>        <div class="col-sm-4">demo 2</div>        <div class="col-sm-3">demo 2</div>        <div class="col-sm-1 ">            <a class="fa fa-plus" data-toggle="collapse" href="#collapse2" aria-expanded="true" aria-controls="collapse2"></a>        </div>    </div><!--row-->https://codepen.io/benwhittaker25/pen/rNVWyby在引導(dǎo) 4.4 中實(shí)現(xiàn)此目的的最佳方法是什么?
查看完整描述

2 回答

?
紅顏莎娜

TA貢獻(xiàn)1842條經(jīng)驗(yàn) 獲得超13個(gè)贊

您可以在單擊按鈕時(shí)使用事件 Bootstrap 觸發(fā)器來執(zhí)行此操作:


$('.collapse').on('show.bs.collapse hide.bs.collapse', function () {

  // Find the corresponding button

  var $btn = $('[data-toggle="collapse"][href="#' + this.id + '"]');

  // Find the corresponding row

  var $row = $btn.closest('.row');

  

  // Toggle classes

  $btn.toggleClass('fa-minus fa-plus');

  $row.toggleClass('rounded rounded-top');

});

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

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" />

<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>


<div class="container h-100">


    <div class="row no-gutters border-0 rounded align-items-center mt-3">

        <div class="col-sm-4">demo 1</div>

        <div class="col-sm-4">demo 1</div>

        <div class="col-sm-3">demo 1</div>

        <div class="col-sm-1 ">

            <a class="fa fa-plus" data-toggle="collapse" href="#collapse1" aria-expanded="true" aria-controls="collapse1"></a>

        </div>

    </div><!--row-->


    <div class="collapse" id="collapse1">

        <div class="row no-gutters border-0 rounded align-items-center mt-3">

            <div class="col-sm-4">demo 1</div>

            <div class="col-sm-4">demo 1</div>

            <div class="col-sm-4">demo 1</div>

        </div><!--collapse-->

    </div>


    <div class="row no-gutters border-0 rounded align-items-center mt-3">

        <div class="col-sm-4">demo 2</div>

        <div class="col-sm-4">demo 2</div>

        <div class="col-sm-3">demo 2</div>

        <div class="col-sm-1 ">

            <a class="fa fa-plus" data-toggle="collapse" href="#collapse2" aria-expanded="true" aria-controls="collapse2"></a>

        </div>

    </div><!--row-->


    <div class="collapse" id="collapse2">

        <div class="row no-gutters border-0 rounded align-items-center mt-3">

            <div class="col-sm-4">demo 2</div>

            <div class="col-sm-4">demo 2</div>

            <div class="col-sm-4">demo 2</div>

        </div><!--collapse-->

    </div>


    <div class="row no-gutters border-0 rounded align-items-center mt-3">

        <div class="col-sm-4">demo 3</div>

        <div class="col-sm-4">demo 3</div>

        <div class="col-sm-3">demo 3</div>

        <div class="col-sm-1 ">

            <a class="fa fa-plus" data-toggle="collapse" href="#collapse3" aria-expanded="true" aria-controls="collapse3"></a>

        </div>

    </div><!--row-->


    <div class="collapse" id="collapse3">

        <div class="row no-gutters border-0 rounded align-items-center mt-3">

            <div class="col-sm-4">demo 3</div>

            <div class="col-sm-4">demo 3</div>

            <div class="col-sm-4">demo 3</div>

        </div><!--collapse-->

    </div>

</div><!--container-->


查看完整回答
反對(duì) 回復(fù) 2022-09-30
?
慕標(biāo)琳琳

TA貢獻(xiàn)1830條經(jīng)驗(yàn) 獲得超9個(gè)贊

優(yōu)雅的方法是做blex所展示的jquery方式。但是你也可以綁定一個(gè)點(diǎn)擊函數(shù),就像下面的javascript方式一樣:


function toggleClass(item){

    if(item.classList.contains('fa-plus')){

            item.classList.remove('fa-plus');

            item.classList.add('fa-minus');

    }else{

        item.classList.remove('fa-minus');

            item.classList.add('fa-plus');

    }

}

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

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" />

<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>


<div class="container h-100">

<div class="container h-100">


    <div class="row no-gutters border-0 rounded align-items-center mt-3">

        <div class="col-sm-4">demo 1</div>

        <div class="col-sm-4">demo 1</div>

        <div class="col-sm-3">demo 1</div>

        <div class="col-sm-1 ">

            <a class="fa fa-plus" data-toggle="collapse" href="#collapse1" aria-expanded="true" aria-controls="collapse1" onClick="toggleClass(this)"></a>

        </div>

    </div><!--row-->


    <div class="collapse" id="collapse1">

        <div class="row no-gutters border-0 rounded align-items-center mt-3">

            <div class="col-sm-4">demo 1</div>

            <div class="col-sm-4">demo 1</div>

            <div class="col-sm-4">demo 1</div>

        </div><!--collapse-->

    </div>


    <div class="row no-gutters border-0 rounded align-items-center mt-3">

        <div class="col-sm-4">demo 2</div>

        <div class="col-sm-4">demo 2</div>

        <div class="col-sm-3">demo 2</div>

        <div class="col-sm-1 ">

            <a class="fa fa-plus" data-toggle="collapse" href="#collapse2" aria-expanded="true" aria-controls="collapse2" onClick="toggleClass(this)"></a>

        </div>

    </div><!--row-->


    <div class="collapse" id="collapse2">

        <div class="row no-gutters border-0 rounded align-items-center mt-3">

            <div class="col-sm-4">demo 2</div>

            <div class="col-sm-4">demo 2</div>

            <div class="col-sm-4">demo 2</div>

        </div><!--collapse-->

    </div>


    <div class="row no-gutters border-0 rounded align-items-center mt-3">

        <div class="col-sm-4">demo 3</div>

        <div class="col-sm-4">demo 3</div>

        <div class="col-sm-3">demo 3</div>

        <div class="col-sm-1 ">

            <a class="fa fa-plus" data-toggle="collapse" href="#collapse3" aria-expanded="true" aria-controls="collapse3" onClick="toggleClass(this)"></a>

        </div>

    </div><!--row-->


    <div class="collapse" id="collapse3">

        <div class="row no-gutters border-0 rounded align-items-center mt-3" >

            <div class="col-sm-4">demo 3</div>

            <div class="col-sm-4">demo 3</div>

            <div class="col-sm-4">demo 3</div>

        </div><!--collapse-->

    </div>

</div><!--container-->


查看完整回答
反對(duì) 回復(fù) 2022-09-30
  • 2 回答
  • 0 關(guān)注
  • 110 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)