17 lines
542 B
17 lines
542 B
function filterArticles() {
|
|
const tagSelect = document.getElementById('tag-select');
|
|
const selectedTag = tagSelect.value;
|
|
const articles = document.querySelectorAll('.article');
|
|
|
|
articles.forEach(article => {
|
|
const tags = article.getAttribute('data-tags').split(' ');
|
|
if (selectedTag === 'all' || tags.includes(selectedTag)) {
|
|
article.style.display = 'flex';
|
|
} else {
|
|
article.style.display = 'none';
|
|
}
|
|
});
|
|
}
|
|
|
|
// Initial call to display all articles
|
|
filterArticles();
|