Files
Clivelancaster/wwwroot/js/site.js
T
clive c72bd65bfa
Gitea CI/CD / build (push) Failing after 5m0s
Website Refresh
2026-08-11 21:27:27 +10:00

52 lines
1.8 KiB
JavaScript

// Please see documentation at https://learn.microsoft.com/aspnet/core/client-side/bundling-and-minification
// for details on configuring this project to bundle and minify static web assets.
// Write your JavaScript code.
// Mobile Menu Logic
const btn = document.getElementById('mobile-menu-btn');
const menu = document.getElementById('mobile-menu');
const icon = btn.querySelector('i');
const links = menu.querySelectorAll('.mobile-link');
btn.addEventListener('click', () => {
menu.classList.toggle('hidden');
if (menu.classList.contains('hidden')) {
icon.classList.remove('fa-times');
icon.classList.add('fa-bars');
} else {
icon.classList.remove('fa-bars');
icon.classList.add('fa-times');
}
});
links.forEach(link => {
link.addEventListener('click', () => {
menu.classList.add('hidden');
icon.classList.remove('fa-times');
icon.classList.add('fa-bars');
});
});
// Sticky Navbar background on scroll
window.addEventListener('scroll', () => {
const nav = document.getElementById('navbar');
if (window.scrollY > 50) {
nav.classList.add('shadow-md');
nav.classList.replace('bg-white/95', 'bg-white/100');
} else {
nav.classList.remove('shadow-md');
nav.classList.replace('bg-white/100', 'bg-white/95');
}
});
document.addEventListener("DOMContentLoaded", function () {
// Telephone encoded in Base64
const encrypted = "KzYxICgwKTQwMSAwODkgMzA1";
const phone = document.getElementById("contact-phone");
// atob() decodes the Base64 string
const phoneNumber = atob(encrypted);
// Set the span and visible text
phone.textContent = phoneNumber;
// Remove the 'hidden' class to show the link
phone.classList.remove("hidden");
});