Skip to content

Commit 0cc4b71

Browse files
author
Rodrigo Techera
committed
adding functionality to display and hide posts module by tags
1 parent bdd0a6a commit 0cc4b71

File tree

2 files changed

+24
-13
lines changed

2 files changed

+24
-13
lines changed

_includes/blog_tags_filter.html

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,26 @@
88

99
if(jQuery(this).data("tag") == "all") {
1010
jQuery(this).addClass("all-tag-selected");
11+
jQuery('.blog-tag-container').fadeOut('fast', function () {
12+
jQuery('.blog-posts-nav').fadeIn('fast');
13+
});
14+
1115
} else {
1216
jQuery(this).addClass("selected");
17+
18+
jQuery('.blog-tag-container[data-tag="'+jQuery(this).data("tag")+'"]').siblings().fadeOut('fast', function () {
19+
jQuery(this).fadeIn('fast');
20+
});
21+
22+
jQuery('.blog-posts-nav').fadeOut('fast', function () {
23+
jQuery('.blog-tag-container').fadeIn('fast');
24+
});
1325
}
1426
});
1527
});
1628
</script>
1729
<style>
18-
.blog-filter-menu .filter-btn {
30+
.blog-container .blog-vertical .blog-filter-menu .filter-btn {
1931
color: #979797;
2032
border: 1px solid #979797;
2133
display: inline-block;
@@ -28,22 +40,22 @@
2840
margin-bottom: 5px;
2941
}
3042

31-
.blog-filter-menu .all-tag-selected {
43+
.blog-container .blog-vertical .blog-filter-menu .all-tag-selected {
3244
background-color: #979797;
3345
color: #ffffff;
3446
}
3547

36-
.blog-filter-menu .filter-btn.selected {
48+
.blog-container .blog-vertical .blog-filter-menu .filter-btn.selected {
3749
background-color: #e44c2c;
3850
border: 1px solid #e44c2c;
3951
color: #ffffff;
4052
}
4153

42-
.blog-filter-menu .blog-filter {
54+
.blog-container .blog-vertical .blog-filter-menu .blog-filter {
4355
cursor: pointer;
4456
}
4557

46-
.blog-tag-container {
58+
.blog-container .blog-vertical .blog-tag-container {
4759
display: none;
4860
}
4961
</style>

_layouts/blog.html

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,15 @@ <h1 class="blog-index-title">
3333

3434
<div class="main-content-wrapper">
3535
<div class="main-content">
36-
37-
{% include blog_tags_filter.html %}
38-
39-
<div class="container">
36+
<div class="container blog-container">
4037
<div class="row blog-vertical">
41-
{% for post in posts %}
42-
43-
{% include blog_post_nav.html %}
38+
{% include blog_tags_filter.html %}
4439

45-
{% endfor %}
40+
<div class="blog-posts-nav">
41+
{% for post in posts %}
42+
{% include blog_post_nav.html %}
43+
{% endfor %}
44+
</div>
4645
</div>
4746

4847
{% include pagination_buttons.html %}

0 commit comments

Comments
 (0)