-
-
Notifications
You must be signed in to change notification settings - Fork 525
Update index.js #172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update index.js #172
Conversation
Issue :
1. The event listener for nav-mobile-btn is repeated twice. This causes redundant code and adds two identical event listeners to the same element.
2. The code directly tries to access document.getElementById("year").innerHTML = year without checking if the element exists. If there’s no element with the ID year, this will cause an error.
Solution :
1. The second, repeated block for nav-mobile-btn was removed.
2. Added a check to ensure document.getElementById("year") exists before setting its innerHTML.
PR Summary
-
Simplified Mobile Navigation Code
The PR removed some superfluous comments and unnecessary codes related to the mobile navigation button to create a cleaner, more efficient code. -
Current Year Dynamic Setting
A new function was added that automatically sets and updates the current year in the#yearelement, if it’s available on the web page. This means no manual updates will be necessary every year. -
Improved Mobile Navigation Toggle
While refining the mobile navigation code, the toggle functionality has been retained and clarified. This means that mobile users can continue to comfortably navigate through the website with a clearer, simplified code base.
please merge my pull request.
Thank you for the suggestion, but it is not really an issue as it is. I will close the PR for the moment.
Issue :
Solution :