// Get references to the toggle button and menu list const navToggle = document.querySelector('.site-nav__toggle'); const navList = document.querySelector('.site-nav__list'); // Add event listeners for click and keydown events navToggle.addEventListener('click', toggleNav); function toggleNav() { // Toggle the "active" class on the toggle button and "visible" class on the menu list navToggle.classList.toggle('active'); navList.classList.toggle('visible'); // Set focus to the toggle button when the menu is opened if (navToggle.classList.contains('active')) { navToggle.focus(); } } $(document).ready(function() { // Listen for the 'keydown' event on top-level menu items $('.site-nav__list > li > a').on('keydown', function(event) { // If the 'Tab' key was pressed if (event.key === 'Tab') { // Show the corresponding submenu $(this).next('ul').show(); } }); }); //-------------for Time--------------- function updateTime() { var now = new Date(); var hours = now.getHours(); var minutes = now.getMinutes(); var seconds = now.getSeconds(); var ampm = hours >= 12 ? 'PM' : 'AM'; hours = hours % 12; hours = hours ? hours : 12; // the hour '0' should be '12' minutes = minutes < 10 ? '0'+minutes : minutes; seconds = seconds < 10 ? '0'+seconds : seconds; var time = hours + ':' + minutes + ':' + seconds + ' ' + ampm; document.getElementById('clock').innerHTML = time; setTimeout(updateTime, 1000); // update every second } updateTime();