Skip to content Skip to sidebar Skip to footer

Filtering Data By Category

I have a javascript function that filters categories. There is also interleaving of lists in php.blade. The problem is that alternation only works when filtering has All, and when

Solution 1:

Change the way of styling. currently, you are using the blog--left and blog--right for the left and right section remove that class from the div and apply the below style to the style.

.blog {
    width: 50%;
}

Solution 2:

Alternation doesn't work, because you have your "alternation" implemented with PHP. PHP - is server side. You are implementing filtering on js - clients side. So when you select any filter you page (html) is not re-rendering (@foreach ($blogs as $index => $blog) is not running anymore because it is PHP). So my suggestion would be:

  • remove classes blog--left, blog--right
  • add style for the .blog class .blog{width:50%; float: left;} (if your .blog has any margins you can try width 49% or less)

Post a Comment for "Filtering Data By Category"