Default Image

new post

podsjfasfpjfdasfdjaäsjfpajsfläkjdsaäfa

askjfajfajfajfksajfaf

podsjfsajfa

$(document).ready(function() {
  // Attach click event handlers to the category buttons
  $('.category-btn').on('click', function() {
    // Get the category ID from the button's data attribute
    var categoryId = $(this).data('category-id');

    // Show all posts if no category is selected
    if (categoryId === undefined) {
      $('.post-card').show();
    }
    else {
      // Hide all posts that don't match the selected category
      $('.post-card').each(function() {
        if ($(this).data('category-id') != categoryId) {
          $(this).hide();
        }
        else {
          $(this).show();
        }
      });
    }
  });

  // Attach click event handler to the "Show All Posts" button
  $('#show-all-btn').on('click', function() {
    $('.post-card').show();
  });
});
data science django food

May 2, 2023, 8:36 p.m.