LauraMDB commited on
Commit
03d7153
·
verified ·
1 Parent(s): 0edbb4c

add a drop down to select several options under each course tile

Browse files
Files changed (1) hide show
  1. script.js +12 -2
script.js CHANGED
@@ -90,12 +90,22 @@ function renderCalendar() {
90
  calendarDays.appendChild(cell);
91
  }
92
  }
 
 
 
 
 
 
 
 
 
 
 
93
 
94
  // Initialize the page
95
  document.addEventListener('DOMContentLoaded', () => {
96
  renderCalendar();
97
-
98
- // Month navigation
99
  document.getElementById('prev-month').addEventListener('click', () => {
100
  currentMonth--;
101
  if (currentMonth < 0) {
 
90
  calendarDays.appendChild(cell);
91
  }
92
  }
93
+ // Close dropdowns when clicking outside
94
+ document.addEventListener('click', function(event) {
95
+ if (!event.target.matches('.dropdown-btn')) {
96
+ const dropdowns = document.querySelectorAll('.dropdown-content');
97
+ dropdowns.forEach(dropdown => {
98
+ if (dropdown.classList.contains('show')) {
99
+ dropdown.classList.remove('show');
100
+ }
101
+ });
102
+ }
103
+ });
104
 
105
  // Initialize the page
106
  document.addEventListener('DOMContentLoaded', () => {
107
  renderCalendar();
108
+ // Month navigation
 
109
  document.getElementById('prev-month').addEventListener('click', () => {
110
  currentMonth--;
111
  if (currentMonth < 0) {