Skip to content

Commit cb4a0d5

Browse files
committed
Fav added
1 parent 0e711da commit cb4a0d5

1 file changed

Lines changed: 98 additions & 0 deletions

File tree

fav.html

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,66 @@
2727
2828
</a>
2929

30+
<div class="filter-container" style="
31+
position: fixed;
32+
top: 10px;
33+
right: 10px;
34+
z-index: 1000;
35+
display: flex;
36+
gap: 5px;
37+
">
38+
<button class="filter-btn active" data-filter="all" style="
39+
background-color: white;
40+
color: #000;
41+
padding: 8px 12px;
42+
border: 1px solid #ccc;
43+
border-radius: 5px;
44+
font-family: sans-serif;
45+
font-size: 12px;
46+
cursor: pointer;
47+
">All</button>
48+
<button class="filter-btn" data-filter="tv" style="
49+
background-color: white;
50+
color: #000;
51+
padding: 8px 12px;
52+
border: 1px solid #ccc;
53+
border-radius: 5px;
54+
font-family: sans-serif;
55+
font-size: 12px;
56+
cursor: pointer;
57+
">TV</button>
58+
<button class="filter-btn" data-filter="movie" style="
59+
background-color: white;
60+
color: #000;
61+
padding: 8px 12px;
62+
border: 1px solid #ccc;
63+
border-radius: 5px;
64+
font-family: sans-serif;
65+
font-size: 12px;
66+
cursor: pointer;
67+
">Movies</button>
68+
<button class="filter-btn" data-filter="book" style="
69+
background-color: white;
70+
color: #000;
71+
padding: 8px 12px;
72+
border: 1px solid #ccc;
73+
border-radius: 5px;
74+
font-family: sans-serif;
75+
font-size: 12px;
76+
cursor: pointer;
77+
">Books</button>
78+
<button class="filter-btn" data-filter="game" style="
79+
background-color: white;
80+
color: #000;
81+
padding: 8px 12px;
82+
border: 1px solid #ccc;
83+
border-radius: 5px;
84+
font-family: sans-serif;
85+
font-size: 12px;
86+
cursor: pointer;
87+
">Games</button>
88+
</div>
89+
3090
<div class="gallery-container">
3191

3292
<div class="gallery">
@@ -70,5 +130,43 @@
70130
</div>
71131

72132
</div>
133+
134+
<script>
135+
document.addEventListener('DOMContentLoaded', function() {
136+
const filterBtns = document.querySelectorAll('.filter-btn');
137+
const galleryItems = document.querySelectorAll('.gallery');
138+
139+
filterBtns.forEach(btn => {
140+
btn.addEventListener('click', function() {
141+
const filter = this.getAttribute('data-filter');
142+
143+
// Update active button
144+
filterBtns.forEach(b => {
145+
b.classList.remove('active');
146+
b.style.backgroundColor = 'white';
147+
b.style.color = '#000';
148+
});
149+
this.classList.add('active');
150+
this.style.backgroundColor = '#333';
151+
this.style.color = 'white';
152+
153+
// Filter items
154+
galleryItems.forEach(item => {
155+
if (filter === 'all') {
156+
item.style.display = 'block';
157+
} else {
158+
const tag = item.querySelector(`.tag.${filter}`);
159+
if (tag) {
160+
item.style.display = 'block';
161+
} else {
162+
item.style.display = 'none';
163+
}
164+
}
165+
});
166+
});
167+
});
168+
});
169+
</script>
170+
73171
</body>
74172
</html>

0 commit comments

Comments
 (0)