diff --git a/scripts/blog.js b/scripts/blog.js index f4e6038..49b55eb 100644 --- a/scripts/blog.js +++ b/scripts/blog.js @@ -22,10 +22,10 @@ function populateBlog(json, cat) { list.html(""); cats.html(""); - addCatButton(json, cats, "All"); + addCatButton(json, cats, "All", cat); for (let i = json.length - 1; i >= 0; i--) { let obj = json[i]; - addCatButton(json, cats, obj.cat); + addCatButton(json, cats, obj.cat, cat); if (cat === "All" || obj.cat === cat) { let p = /*html*/ `
@@ -49,10 +49,10 @@ function populateBlog(json, cat) { archive.html(`There are no archived ${cat} posts.`); } -function addCatButton(json, cats, cat) { +function addCatButton(json, cats, cat, currCat) { let catAnchor = `blog-cat-${cat.toLowerCase().replace(" ", "_")}`; if (!$(`#${catAnchor}`).length) { - cats.append( /*html*/ ``); + cats.append( /*html*/ ``); $(`#${catAnchor}`).on('click', function () { populateBlog(json, cat); });