mirror of
https://github.com/WatchOutNewsAgency/wona.github.com.git
synced 2026-01-01 01:16:26 +00:00
Compare commits
1 Commits
9fc7bb2e61
...
anee-branc
| Author | SHA1 | Date | |
|---|---|---|---|
| 58cb5c09f2 |
@ -105,17 +105,20 @@
|
|||||||
<script>
|
<script>
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
document.addEventListener('DOMContentLoaded', function() {
|
||||||
// Mobile menu elements
|
// Mobile menu elements
|
||||||
const mobileToggle = document.getElementById('mobile-menu-toggle');
|
|
||||||
const mobileNav = document.getElementById('mobile-nav');
|
const mobileNav = document.getElementById('mobile-nav');
|
||||||
const mobileNavOverlay = document.getElementById('mobile-nav-overlay');
|
const mobileNavOverlay = document.getElementById('mobile-nav-overlay');
|
||||||
const mobileNavClose = document.getElementById('mobile-nav-close');
|
const mobileNavClose = document.getElementById('mobile-nav-close');
|
||||||
|
const mobileToggle = document.getElementById('mobile-menu-toggle');
|
||||||
// Function to open mobile menu
|
// Function to open mobile menu
|
||||||
function openMobileMenu() {
|
function openMobileMenu() {
|
||||||
if (mobileNav && mobileNavOverlay) {
|
if (mobileNav && mobileNavOverlay) {
|
||||||
mobileNav.classList.add('show');
|
mobileNav.classList.add('show');
|
||||||
mobileNavOverlay.classList.add('show');
|
mobileNavOverlay.classList.add('show');
|
||||||
mobileToggle.classList.add('active');
|
const toggle = document.getElementById('mobile-menu-toggle');
|
||||||
|
if (toggle) {
|
||||||
|
toggle.parentElement.removeChild(toggle);
|
||||||
|
}
|
||||||
document.body.style.overflow = 'hidden'; // Prevent body scroll
|
document.body.style.overflow = 'hidden'; // Prevent body scroll
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -125,9 +128,29 @@ document.addEventListener('DOMContentLoaded', function() {
|
|||||||
if (mobileNav && mobileNavOverlay) {
|
if (mobileNav && mobileNavOverlay) {
|
||||||
mobileNav.classList.remove('show');
|
mobileNav.classList.remove('show');
|
||||||
mobileNavOverlay.classList.remove('show');
|
mobileNavOverlay.classList.remove('show');
|
||||||
mobileToggle.classList.remove('active');
|
|
||||||
document.body.style.overflow = ''; // Restore body scroll
|
document.body.style.overflow = ''; // Restore body scroll
|
||||||
|
if (!document.getElementById('mobile-menu-toggle')) {
|
||||||
|
const newToggle = document.createElement('button');
|
||||||
|
newToggle.type = 'button';
|
||||||
|
newToggle.id = 'mobile-menu-toggle';
|
||||||
|
newToggle.className = 'navbar-toggle visible-xs position-fixed top-0 end-0 m-3 z-1030';
|
||||||
|
newToggle.innerHTML = `
|
||||||
|
<span class="sr-only">Toggle navigation</span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
<span class="icon-bar"></span>
|
||||||
|
`;
|
||||||
|
|
||||||
|
const container = document.querySelector('.pre-nav');
|
||||||
|
if (container) container.appendChild(newToggle);
|
||||||
|
|
||||||
|
newToggle.addEventListener('click', function(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
openMobileMenu();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// Close all open dropdowns
|
// Close all open dropdowns
|
||||||
const openDropdowns = document.querySelectorAll('.mobile-nav .dropdown.open');
|
const openDropdowns = document.querySelectorAll('.mobile-nav .dropdown.open');
|
||||||
openDropdowns.forEach(function(dropdown) {
|
openDropdowns.forEach(function(dropdown) {
|
||||||
|
|||||||
Reference in New Issue
Block a user