FAQ Filter Buttons

HTML

<div id="hs_cos_wrapper_widget_1622225529345" class="hs_cos_wrapper hs_cos_wrapper_widget hs_cos_wrapper_type_module" style="" data-hs-cos-general-type="widget" data-hs-cos-type="module">  <div id="myBtnContainer">
    <button class="btnfilter active" onclick="filterSelection('all')">Show All</button>
  </div>


  <div id="myBtnContainer">
    <button class="btnfilter active" onclick="filterSelection('about-us')"><div id="hs_cos_wrapper_widget_1622225529345_" class="hs_cos_wrapper hs_cos_wrapper_widget hs_cos_wrapper_type_inline_text" style="" data-hs-cos-general-type="widget" data-hs-cos-type="inline_text" data-hs-cos-field="faq_topic">About Us</div></button>
  </div>

  <div id="myBtnContainer">
    <button class="btnfilter active" onclick="filterSelection('software')"><div id="hs_cos_wrapper_widget_1622225529345_" class="hs_cos_wrapper hs_cos_wrapper_widget hs_cos_wrapper_type_inline_text" style="" data-hs-cos-general-type="widget" data-hs-cos-type="inline_text" data-hs-cos-field="faq_topic">Software</div></button>
  </div>

  <div id="myBtnContainer">
    <button class="btnfilter active" onclick="filterSelection('licensing')"><div id="hs_cos_wrapper_widget_1622225529345_" class="hs_cos_wrapper hs_cos_wrapper_widget hs_cos_wrapper_type_inline_text" style="" data-hs-cos-general-type="widget" data-hs-cos-type="inline_text" data-hs-cos-field="faq_topic">Licensing</div></button>
  </div>



<div class="faqfullgroup about-us show">
    <div id="hs_cos_wrapper_widget_1622225529345_" class="hs_cos_wrapper hs_cos_wrapper_widget hs_cos_wrapper_type_inline_text" style="" data-hs-cos-general-type="widget" data-hs-cos-type="inline_text" data-hs-cos-field="faq_topic">About Us</div>
    
  <div class="accordion">
      <div class="accordion_group ">
          <div class="accordion_header"><span class="accordion_icon"></span> <div id="hs_cos_wrapper_widget_1622225529345_" class="hs_cos_wrapper hs_cos_wrapper_widget hs_cos_wrapper_type_inline_text" style=""...

CSS

.accordion {}
.accordion_group {
    margin-bottom: 2px;
    background: #f0f0f0;
    padding: 5px 10px;
}
.accordion_header {
    cursor: pointer;
    font-size: 18px;
    line-height: 16px;
    width: 100%;
    padding: 10px 15px;
}
.accordion_icon{
    color: #34495e;
    padding-right: 16px;
    background-color: #34495e;
    margin-right: 10px;
    font-size: 14px;
    border-radius: 3px;
}
.accordion_content { 
    padding: 10px 15px;
    display: none;
}

.accordion_group .accordion_icon {
    position: relative;
}
.accordion_group .accordion_icon::before,
.accordion_group .accordion_icon::after {
    content: '';
    display: block;
    position: absolute;
    top: 50%;
    right: 3px;
    width: 10px;
    height: 2px;
    margin-top: -1px;
    -webkit-transform-origin: 50% 50%;
    -ms-transform-origin: 50% 50%;
    transform-origin: 50% 50%;
    -webkit-transition: all .25s;
    transition: all .25s;
    background-color: #f0f0f0;
}
.accordion_group.expanded .accordion_icon::before {
    -webkit-transform: rotate(0deg);
    -ms-transform: rotate(0deg);
    transform: rotate(0deg);
    opacity: 0;
}
.accordion_group .accordion_icon::before {
    -webkit-transform: rotate(-90deg);
    -ms-transform: rotate(-90deg);
    transform: rotate(-90deg);
    opacity: 1;
}
.accordion_group .accordion_icon::after {
    -webkit-transform: rotate(0deg);
    -ms-transform: rotate(0deg);
    transform: rotate(0deg);
}
.accordion_group.expanded .accordion_icon::after {
    -webkit-transform: rotate(180deg);
    -ms-transform: rotate(180deg);
    transform: rotate(180deg)
}

[data-hs-cos-field="faq_question"] {
    display: inline-block;
    vertical-align: middle;
}

[data-hs-cos-field="faq_topic"] {
    font-size: 228.5%;
    line-height: 1.4;
    letter-spacing: 0;
    text-rendering: optimizelegibility;
    font-style: normal;
    font-weight: 700;
    font-family: 'Avenir Next W01 Thin',Arial,Helvetica,sans-serif !important;
    margin: 1em auto .5em auto;
}

/*...

JavaScript

//FILTER BUTTONS CSS
filterSelection("all") // Execute the function and show all columns
function filterSelection(c) {
  var x, i;
  x = document.getElementsByClassName("faqfullgroup");
  if (c == "all") c = "";
  // Add the "show" class (display:block) to the filtered elements, and remove the "show" class from the elements that are not selected
  for (i = 0; i < x.length; i++) {
    w3RemoveClass(x[i], "show");
    if (x[i].className.indexOf(c) > -1) w3AddClass(x[i], "show");
  }
}

// Show filtered elements
function w3AddClass(element, name) {
  var i, arr1, arr2;
  arr1 = element.className.split(" ");
  arr2 = name.split(" ");
  for (i = 0; i < arr2.length; i++) {
    if (arr1.indexOf(arr2[i]) == -1) {
      element.className += " " + arr2[i];
    }
  }
}

// Hide elements that are not selected
function w3RemoveClass(element, name) {
  var i, arr1, arr2;
  arr1 = element.className.split(" ");
  arr2 = name.split(" ");
  for (i = 0; i < arr2.length; i++) {
    while (arr1.indexOf(arr2[i]) > -1) {
      arr1.splice(arr1.indexOf(arr2[i]), 1);
    }
  }
  element.className = arr1.join(" ");
}

// Add active class to the current button (highlight it)
var btnContainer = document.getElementById("myBtnContainer");
var btns = btnContainer.getElementsByClassName("btnfilter");
for (var i = 0; i < btns.length; i++) {
  btns[i].addEventListener("click", function(){
    var current = document.getElementsByClassName("active");
    current[0].className = current[0].className.replace(" active", "");
    this.className += " active";
  });
}




//ACORDIAN CSS
$(document).ready(function() { 
    var $accordion = $('.accordion');

    // Initially hide all accordion content
    $accordion.find('.accordion_content').hide();
    // Initially display the accordion content with .expanded class
    $accordion.find('.accordion_group.expanded .accordion_content').show();

    $accordion.find('.accordion_header').click(function(){

        // Hide the displayed sibling accordion content...