css: bootstrap accordion


Best 60+ HTML Admin Dashboard Templates For 2022
https://themefisher.com/html-admin-dashboard-templates

40 Free Bootstrap Admin Dashboard Templates For Your Web App 2022
https://colorlib.com/wp/free-bootstrap-admin-dashboard-templates/

Free Admin Dashboard Templates

The 23 Best HTML Dashboard Templates for Admins & Users
https://blog.hubspot.com/website/best-html5-admin-dashboard-templates


Best 70+ Admin Dashboard Templates 2022
https://themefisher.com/dashboard-templates

20+ Best Figma Dashboard Templates (Admin Dashboard UI Kits & More)
https://designshack.net/articles/inspiration/figma-dashboard-templates/

30 Bootstrap 5 Admin / Dashboard HTML Template – 2022
https://athemeart.com/blog/bootstrap-5-dashboard-template/


Colorlib content is free. When you buy through links on our site, we may earn an affiliate commission. Learn More
40 Free Bootstrap Admin Dashboard Templates For Your Web App 2022
https://colorlib.com/wp/free-bootstrap-admin-dashboard-templates/



 

 

https://getbootstrap.com/docs/5.2/components/accordion/

 

bootstrap 4

<!DOCTYPE html>
<html lang="en" >

<head>

  <meta charset="UTF-8">
  
<link rel="apple-touch-icon" type="image/png" href="geovindu.png" />
<meta name="apple-mobile-web-app-title" content="geovindu">
<link rel="shortcut icon" type="image/x-icon" href="geovindu.ico" />
<link rel="mask-icon" type="image/x-icon" href="geovindu.svg" color="#111" />


  <title>CodePen - bootstrap accordion</title>
	    <meta name="author" content="Geovin Du,塗聚文">
    <meta name="keyword" content="browser does support HTML5 canvas element:Google Chrome V 8+;Mozilla Firefox V 3.6+;Opera V 11+;Apple Safari V 5+;Microsoft Internet Explorer V 9+">
    <meta name="description" content="塗聚文">
  <link rel='stylesheet' href="../bootstrap-4.6.0/dist/css/bootstrap.min.css">
  
<style>
.accordion-container .card .card-header button.btn:after {
  -webkit-transition: all 0.5s ease-in-out;
  -moz-transition: all 0.5s ease-in-out;
  -ms-transition: all 0.5s ease-in-out;
  transition: all 0.5s ease-in-out;
}
.accordion-container .card .card-header {
  position: relative;
  background-color: #343434;
}
.accordion-container .card .card-header .btn-link {
  color: #FFFFFF;
  font-family: Montserrat;
  font-size: 19px;
  font-weight: 600;
  line-height: 23px;
}
.accordion-container .card .card-header button.btn.collapsed:after {
  background-image: url(data:image/svg+xml;utf8;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pgo8IS0tIEdlbmVyYXRvcjogQWRvYmUgSWxsdXN0cmF0b3IgMTguMS4xLCBTVkcgRXhwb3J0IFBsdWctSW4gLiBTVkcgVmVyc2lvbjogNi4wMCBCdWlsZCAwKSAgLS0+CjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0iQ2FwYV8xIiB4PSIwcHgiIHk9IjBweCIgdmlld0JveD0iMCAwIDIyLjA2MiAyMi4wNjIiIHN0eWxlPSJlbmFibGUtYmFja2dyb3VuZDpuZXcgMCAwIDIyLjA2MiAyMi4wNjI7IiB4bWw6c3BhY2U9InByZXNlcnZlIiB3aWR0aD0iMTZweCIgaGVpZ2h0PSIxNnB4Ij4KPGc+Cgk8cGF0aCBkPSJNMjEuNDU0LDUuNTEzbC0wLjczNy0wLjczN2MtMC44MDgtMC44MS0yLjEzNC0wLjgxLTIuOTQzLDBsLTYuNzQzLDYuNzQyTDQuMjg5LDQuNzc2ICAgYy0wLjgwOS0wLjgxLTIuMTM1LTAuODEtMi45NDQsMEwwLjYwOCw1LjUxM2MtMC44MTEsMC44MDktMC44MTEsMi4xMzUsMCwyLjk0NWw4LjgzNSw4LjgzNWMwLjQzNSwwLjQzNSwxLjAxOCwwLjYyOCwxLjU4NywwLjU5NyAgIGMwLjU3MSwwLjAzMSwxLjE1NC0wLjE2MiwxLjU4OC0wLjU5N2w4LjgzNi04LjgzNUMyMi4yNjQsNy42NDksMjIuMjY0LDYuMzIzLDIxLjQ1NCw1LjUxM3oiIGZpbGw9IiMzNDM0MzQi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LDAuMTYyLTEuNTg4LDAuNTk4bC04LjgzNiw4LjgzNSAgIGMtMC44MTIsMC44MS0wLjgxMiwyLjEzNSwwLDIuOTQ0bDAuNzM5LDAuNzM3YzAuODA4LDAuODEsMi4xMzQsMC44MSwyLjk0MiwwbDYuNzQyLTYuNzQybDYuNzQyLDYuNzQyICAgYzAuODA5LDAuODEsMi4xMzUsMC44MSwyLjk0MiwwbDAuNzM3LTAuNzM3QzIyLjI2NywxNS43NDEsMjIuMjY3LDE0LjQxNSwyMS40NTYsMTMuNjA1eiIgZmlsbD0iIzg2MDAyMSIvPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+CjxnPgo8L2c+Cjwvc3ZnPgo=);
}
.accordion-container .card .card-header button.btn.btn-link {
  width: 100%;
  text-align: left;
}
.accordion-container .card .card-header button.btn:after {
  content: "";
  background-repeat: no-repeat;
  background-position: 50%;
  width: 3rem;
  height: 3rem;
  text-align: center;
  float: right;
  padding: 0.7rem;
  border: 1px solid #ffff;
  border-radius: 50%;
}
.accordion-container .card .card-header button.btn.collapsed:after {
  background-color: rgba(255, 255, 255, 0.31);
}
.accordion-container .card .card-header button.btn:not(.collapsed):after {
  background-color: white;
}
.accordion-container .card .card-header button.btn-link:not(.collapsed)::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: #400010;
  opacity: 0.31;
}
.accordion-container .card .card-body {
  color: white;
  background-color: #860021;
  color: #FFFFFF;
  font-family: Montserrat;
  font-size: 16px;
  font-weight: 300;
  line-height: 19px;
}
</style>

  <script>
  window.console = window.console || function(t) {};
</script>

  
  
  <script>
  if (document.location.search.match(/type=embed/gi)) {
    window.parent.postMessage("resize", "*");
  }
</script>


</head>

<body translate="no" >
  <section class="container">
  <div id="accordion" class="accordion-container">
    <div class="card">
      <div class="card-header" id="headingOne">
        <h5 class="mb-0">
          <button class="btn btn-link" data-toggle="collapse" data-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
           Lorem Item #1
          </button>
        </h5>
      </div>

      <div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
        <div class="card-body">
          Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
        </div>
      </div>
    </div>
    <div class="card">
      <div class="card-header" id="headingTwo">
        <h5 class="mb-0">
          <button class="btn btn-link collapsed" data-toggle="collapse" data-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
            Lorem Item  Item #2
          </button>
        </h5>
      </div>
      <div id="collapseTwo" class="collapse" aria-labelledby="headingTwo" data-parent="#accordion">
        <div class="card-body">
          Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
        </div>
      </div>
    </div>
    <div class="card">
      <div class="card-header" id="headingThree">
        <h5 class="mb-0">
          <button class="btn btn-link collapsed" data-toggle="collapse" data-target="#collapseThree" aria-expanded="false" aria-controls="collapseThree">
            Lorem Item  Item #3
          </button>
        </h5>
      </div>
      <div id="collapseThree" class="collapse" aria-labelledby="headingThree" data-parent="#accordion">
        <div class="card-body">
          Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
        </div>
      </div>
    </div>
  </div>
  
</section>
  
<script src="jquery-3.3.1.min.js"></script>
<script src='../bootstrap-4.6.0/dist/js/bootstrap.min.js'></script>
  
  

</body>

</html>

  bootstrap 5.0

 

<!DOCTYPE html>
<html lang="en" >

<head>

  <meta charset="UTF-8"> 



  <title> bootstrap accordion with arrow in vanilla js</title>
    <meta name="author" content="Geovin Du,塗聚文">
    <meta name="keyword" content="browser does support HTML5 canvas element:Google Chrome V 8+;Mozilla Firefox V 3.6+;Opera V 11+;Apple Safari V 5+;Microsoft Internet Explorer V 9+">
    <meta name="description" content="塗聚文">

  <link rel='stylesheet' href='dist/css/bootstrap.min.css'/>
  
<style>
.accordion {
  margin-top: 40px;
}
.accordion .card {
  border: none;
  margin-bottom: 20px;
}
.accordion .card h2 {
  background: url(arrow56-512.png) no-repeat calc(100% - 10px) center;
  background-size: 20px;
  cursor: pointer;
  font-size: 18px;
}
.accordion .card h2.collapsed {
  background-image: url(expand2-256.png);
}
.accordion .card-body {
  padding-left: 0;
  padding-right: 0;
}
</style>

  <script>
 // window.console = window.console || function(t) {};
</script>

  
  
  <script>
  if (document.location.search.match(/type=embed/gi)) {
    window.parent.postMessage("resize", "*");
  }
</script>


</head>

<body translate="no" >
  <div class="container">
  <div class="accordion" id="accordionExample">
  <div class="card">
    <div class="card-head" id="headingOne">
      <h2 class="mb-0" data-toggle="collapse" data-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
          Collapsible Group Item #1
      </h2>
    </div>

    <div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordionExample">
      <div class="card-body">
        Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
      </div>
    </div>
  </div>
  <div class="card">
    <div class="card-head" id="headingTwo">
      <h2 class="mb-0 collapsed" data-toggle="collapse" data-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
          Collapsible Group Item #2
      </h2>
    </div>
    <div id="collapseTwo" class="collapse" aria-labelledby="headingTwo" data-parent="#accordionExample">
      <div class="card-body">
        Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
      </div>
    </div>
  </div>
  <div class="card">
    <div class="card-head" id="headingThree">
      <h2 class="mb-0 collapsed" data-toggle="collapse" data-target="#collapseThree" aria-expanded="false" aria-controls="collapseThree">
          Collapsible Group Item #3
      </h2>
    </div>
    <div id="collapseThree" class="collapse" aria-labelledby="headingThree" data-parent="#accordionExample">
      <div class="card-body">
        Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
      </div>
    </div>
  </div>
</div>
</div>

<script src="dist/js/bootstrap.bundle.js"></script>
  
      <script>
		  //https://www.bootstrapdash.com/bootstrap-accordion-examples/
var accordion = document.querySelectorAll('.accordion');
var headingLink = [];

accordion.forEach(function (e) {
  headingLink = e.querySelectorAll("[data-toggle='collapse']");

  headingLink.forEach(function (he) {
    he.addEventListener('click', openAccordion);

  });

});

function openAccordion(param) {
  var currentHeading = param.currentTarget;
  var dataTarget = param.currentTarget.dataset.target;
  var currentContent = document.querySelector(dataTarget);
  var collapseDiv = document.querySelectorAll('.collapse');


  headingLink.forEach(function (cp) {
    cp.classList.add('collapsed');
  });
  currentHeading.classList.remove('collapsed');
  collapseDiv.forEach(function (cd) {
    cd.classList.remove('show');
  });
  currentContent.classList.add('show');
}
//# 
    </script>

  

</body>

</html>
 

  

posted @ 2022-06-23 14:23  ®Geovin Du Dream Park™  阅读(28)  评论(0)    收藏  举报