Skip to content

Instantly share code, notes, and snippets.

@williamromero
Last active May 24, 2020 04:50
Show Gist options
  • Save williamromero/a292ca78ce7cd44be44edd6d4283ac2f to your computer and use it in GitHub Desktop.
Save williamromero/a292ca78ce7cd44be44edd6d4283ac2f to your computer and use it in GitHub Desktop.
Code Snippet to Filter by Brand
$('a[filter-by="m&m"]').click(function(){
var mix = $('.mix').children('.text-block-8');
mix.each(function(index){
if ($(this).text() === 'M&M') {
$(this).parent().show();
} else {
$(this).parent().hide();
}
});
});
$('a[filter-by="Sun Vibes"]').click(function(){
var mix = $('.mix').children('.text-block-8');
mix.each(function(index){
if ($(this).text() === 'Sun Vibes') {
$(this).parent().show();
} else {
$(this).parent().hide();
}
});
});
$('a[filter-by="BeachBreak"]').click(function () {
var mix = $('.mix').children('.text-block-8');
mix.each(function (index) {
if ($(this).text() === 'BeachBreak') {
$(this).parent().show();
} else {
$(this).parent().hide();
}
});
});
$('a[filter-by="boho"]').click(function () {
var mix = $('.mix').children('.text-block-8');
mix.each(function (index) {
if ($(this).text() === 'boho') {
$(this).parent().show();
} else {
$(this).parent().hide();
}
});
});
// https://codepen.io/andrewbvsn/pen/yJOzXm?editors=1010
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment