Skip to content
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

Added dropdown autoclose on choosing option #1322

Merged
merged 1 commit into from
Aug 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 22 additions & 9 deletions website/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,19 +68,19 @@
class="hidden text-white backdrop-blur opacity-85 fixed right-0 z-20 bg-neutral-900 w-full p-12 flex flex-col justify-center items-center lg:hidden">
<ul>

<li class="py-4">
<li class="py-4 menu-link">
<a href="#intro" class="no-new-tab font-semibold hover-effect">Introduction</a>
</li>
<li class="py-4">
<li class="py-4 menu-link">
<a href="#domains" class="no-new-tab font-semibold hover-effect">Domains</a>
</li>
<li class="py-4">
<li class="py-4 menu-link">
<a href="#contribution" class="no-new-tab font-semibold hover-effect">Contribution</a>
</li>
<li class="py-4">
<li class="py-4 menu-link">
<a href="#contents" class="no-new-tab font-semibold hover-effect">Contents</a>
</li>
<li class="py-4">
<li class="py-4 menu-link">
<a href="#contributors" class="no-new-tab font-semibold hover-effect">Contributors</a>
</li>

Expand Down Expand Up @@ -498,7 +498,7 @@ <h4 class="ml-4 text-xl font-bold text-white text-center">Steps to Contribute:</
</div>
<div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-2 lg:grid-cols-3 gap-6">
<div
class="w-full bg-gray-800 rounded-lg sahdow-lg overflow-hidden flex flex-col justify-center items-center">
class="w-full transition-transform duration-300 transform hover:scale-105 bg-gray-800 rounded-lg sahdow-lg overflow-hidden flex flex-col justify-center items-center">
<div>
<img class="object-center object-cover h-auto w-full"
src="https://img.freepik.com/premium-photo/3d-rendering-robot-artificial-intelligence-black-background-futuristic-technology-robot_844516-420.jpg"
Expand Down Expand Up @@ -680,20 +680,33 @@ <h4 class="ml-4 text-xl font-bold text-white text-center">Steps to Contribute:</
<script>




document.addEventListener('DOMContentLoaded', function () {
const menuButton = document.getElementById('menuButton');
const menuIcon = document.getElementById('menuIcon');
const closeIcon = document.getElementById('closeIcon');
const mobileMenu = document.getElementById('mobileMenu');
const menuLinks = document.getElementsByClassName('menu-link'); // Fixed selector

menuButton.addEventListener('click', function () {
// Function to toggle menu visibility
function toggleMenu() {
const isMenuOpen = mobileMenu.classList.toggle('hidden');
menuIcon.classList.toggle('hidden', !isMenuOpen);
closeIcon.classList.toggle('hidden', isMenuOpen);
}

// Add event listener to the menu button
menuButton.addEventListener('click', function () {
toggleMenu();
});

// Add event listener to each menu link
Array.from(menuLinks).forEach(link => {
link.addEventListener('click', function () {
toggleMenu(); // Close the menu when a link is clicked
});
});
});

window.addEventListener('DOMContentLoaded', (event) => {
// Select all anchor tags without the 'no-new-tab' class and add the target attribute with the value '_blank'
const anchorTags = document.querySelectorAll('a:not(.no-new-tab)');
Expand Down
Loading