In portfolio gallery filtering i try to understand the javascript so hard and still dont get it can anyone explain me why -1 here
filterSelection("all")// Execute the function and show all columns functionfilterSelection(c) { varx, i; x = document.getElementsByClassName("column"); 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,"show"); if(x.className.indexOf(c) > -1)w3AddClass(x,"show"); } }
Portfolio gallery with filtering
in JavaScript
Posted
In portfolio gallery filtering i try to understand the javascript so hard and still dont get it can anyone explain me why -1 here
filterSelection("all") // Execute the function and show all columns
function filterSelection(c) {
var x, i;
x = document.getElementsByClassName("column");
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, "show");
if (x.className.indexOf(c) > -1) w3AddClass(x, "show");
}
}
35. How To Create a Portfolio Gallery with Filtering.pdf