//$(document).ready(function(){ //* Loop through all dropdown buttons to toggle between hiding and showing its dropdown content - This allows the user to have multiple dropdowns without any conflict */ var dropdown = document.getElementsByClassName("dropdown-btn"); var i; for (i = 0; i < dropdown.length; i++) { dropdown[i].addEventListener("click", function() { this.classList.toggle("active"); var dropdownContent = this.nextElementSibling; if (dropdownContent.style.display === "block") { dropdownContent.style.display = "none"; } else { dropdownContent.style.display = "block"; } }); } /* Get files matching filters //declare global vars var results = []; //array of records that match the filters var data = {{ index .Site.Data.scRNAseq_huPr_D.updated_cleaned_json }}; var numbers = $("#filter").find(".numbers"); //array of all the places we want to update with the # of records that match the filters var filters = [];//array of current filters //filtering function $("input").click(function(){ // get specific vars var name = $(this).attr("name"); var value = $(this).attr("value"); var id = name + value; id= id.replace(/\s+/g, ''); var filterVar = {"name": name, "value":value, "id":id}; // if checkbox is checked: add filter values to filter if ($(this).prop("checked") == true){ filters.push(filterVar); /* var i; for (i =0; i < data.length; i++){ if( data[i][name] == value){ results.push(data[i]); $("#"+id).text[numbers.length]; } }*/ /* } //if checkbox is not checked: remove filter values from filter else if ($(this).prop("checked") == false){ var i; for (i=0; i<filter.length; i++){ if (filter[i][id]== id){ filter.splice(i, 1); i--; } } } //check data to pull all records that match the current filters var i; var j; for (i = 0; i<filters.length; i++){ var count = 0; $('#displayFiles').text(numbers.length); for (j=0; j <data.length; j++){ // var id2 = results[j][name]. + results[j][name]; // id2 = id2.replace(/\s+/g, ''); // $('#displayFiles').text(id2); if (id2 == numbers[i][id]){ count++; $('#displayFiles').text(count); } } } }); }); */