-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.html
More file actions
79 lines (68 loc) · 2.08 KB
/
Copy pathtest.html
File metadata and controls
79 lines (68 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
body {
margin: 0;
font-family: Arial, sans-serif;
}
.year-box {
border: 1px solid #ccc;
padding: 10px;
max-width: 300px;
margin: 0 auto;
}
.content {
display: none;
}
.content.active {
display: block;
}
/* Media query for small screens */
@media screen and (max-width: 600px) {
.year-box {
max-width: none;
}
}
</style>
</head>
<body>
<div class="year-box adjust-year">
<div>
<h3>Category</h3>
</div>
<div>
<input type="checkbox" name="category" id="latestBlogs" onclick="showContent('latestBlogs')"> Latest Blogs
</div>
<div>
<input type="checkbox" name="category" id="networking" onclick="showContent('networking')"> Networking
</div>
<!-- Content for Latest Blogs -->
<div class="content" id="latestBlogsContent">
<!-- Insert content for Latest Blogs here -->
<p>This is the content for Latest Blogs.</p>
</div>
<!-- Content for Networking -->
<div class="content" id="networkingContent">
<!-- Insert content for Networking here -->
<p>This is the content for Networking.</p>
</div>
</div>
<script>
function showContent(category) {
// Hide all content
var allContent = document.querySelectorAll('.content');
allContent.forEach(function (content) {
content.classList.remove('active');
});
// Show the selected category content
var selectedContent = document.getElementById(category + 'Content');
selectedContent.classList.add('active');
// Scroll to the selected content
selectedContent.scrollIntoView({ behavior: 'smooth' });
}
</script>
</body>
</html>