-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmaths2.js
More file actions
74 lines (62 loc) · 3.68 KB
/
Copy pathmaths2.js
File metadata and controls
74 lines (62 loc) · 3.68 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
document.addEventListener('DOMContentLoaded', function() {
const contentArea = document.getElementById('content-area');
const chaptersContainer = document.getElementById('chapters-container');
const menuToggle = document.querySelector('.menu-toggle');
const navLinks = document.querySelector('.nav-links');
const chaptersData = [
{ name: 'Chapter 1: Similarity', description: 'Delve into the wonders of gravitational force and Kepler\'s laws.',book: 'm2book.html'},
{ name: 'Chapter 2:Pythagoras Theorem', description: 'Explore Dobereiner\'s Triads, Newland’s Law of Octaves, and Mendeleev’s Periodic Table.', book: 'm2book.html' },
{ name: 'Chapter 3: Circle', description: 'Learn about various types of chemical reactions and how to balance chemical equations.', book: 'm2book.html' },
{ name: 'Chapter 4: Geometric Construction', description: 'Understand the heating effects, magnetic effects, and chemical effects of electric current.', book: 'm2book.html' },
{ name: 'Chapter 5: Co-ordinate Geometry', description: 'Understand the heating, magnetic, and chemical effects of electric current.', book: 'm2book.html' },
{ name: 'Chapter 6: Trigonometry', description: 'Study the laws of reflection and image formation by mirrors.', book: 'm2book.html' },
{ name: 'Chapter 7: Mensuration', description: 'Study the laws of reflection and image formation by mirrors.', book: 'm2book.html' }
];
function renderChapters() {
chaptersContainer.innerHTML = '';
chaptersData.forEach((chapter, index) => {
const chapterElement = document.createElement('div');
chapterElement.className = 'chapter';
chapterElement.innerHTML = `
<h3 onclick="toggleSubtopics(this)">${chapter.name} <span>▶</span></h3>
<div class="subtopics">
<p>${chapter.description}</p>
<div class="study-options">
<a href="#" onclick="showVideoLecture(${index})">Video Lecture</a>
<a href="${chapter.book}" onclick="showTheory(${index})">Book</a>
<a href="#" onclick="showFlashcards(${index})">Flashcards</a>
<a href="#" onclick="showGames(${index})">Games</a>
</div>
</div>
`;
chaptersContainer.appendChild(chapterElement);
});
}
function toggleSubtopics(header) {
const subtopics = header.nextElementSibling;
const icon = header.querySelector('span');
subtopics.style.display = subtopics.style.display === "block" ? "none" : "block";
icon.style.transform = subtopics.style.display === "block" ? "rotate(90deg)" : "rotate(0deg)";
}
function showTheory(chapterIndex) {
window.location.href = chaptersData[chapterIndex].book;
}
function showVideoLecture(chapterIndex) {
alert(`Video lecture for ${chaptersData[chapterIndex].name} is not available yet.`);
}
function showFlashcards(chapterIndex) {
alert(`Flashcards for ${chaptersData[chapterIndex].name} are not available yet.`);
}
function showGames(chapterIndex) {
alert(`Games for ${chaptersData[chapterIndex].name} are not available yet.`);
}
menuToggle.addEventListener('click', () => {
navLinks.classList.toggle('active');
});
renderChapters();
window.toggleSubtopics = toggleSubtopics;
window.showTheory = showTheory;
window.showVideoLecture = showVideoLecture;
window.showFlashcards = showFlashcards;
window.showGames = showGames;
});