- Add scroll.js: data-scroll-to attribute drives smooth scrollIntoView; scroll-margin-top at md+ accounts for fixed header offset - Wire Services, FAQ, Book An Appointment, View Our Services nav/hero links to on-page anchors; don't close hamburger on scroll-link clicks - Refactor booking calendar: own the fetch (useEffect + dateRange state) instead of handing URL to FullCalendar; removes fetchedRef complexity; noSlotsInMonth derived cleanly from fetchLoading + fetchedEvents - Success state shows appointment summary (name, service, date/time); hides calendar/form on success; no "book another" button Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
29 lines
931 B
JavaScript
29 lines
931 B
JavaScript
(function () {
|
|
'use strict';
|
|
|
|
document.addEventListener('DOMContentLoaded', function () {
|
|
var btn = document.querySelector('.rpt-header__hamburger');
|
|
var nav = document.getElementById('rpt-main-nav');
|
|
if (!btn || !nav) return;
|
|
|
|
btn.addEventListener('click', function () {
|
|
var open = nav.classList.toggle('is-open');
|
|
btn.setAttribute('aria-expanded', String(open));
|
|
});
|
|
|
|
nav.querySelectorAll('a').forEach(function (link) {
|
|
link.addEventListener('click', function () {
|
|
if (link.dataset.scrollTo) return; // page scrolls away — no need to close
|
|
nav.classList.remove('is-open');
|
|
btn.setAttribute('aria-expanded', 'false');
|
|
});
|
|
});
|
|
|
|
document.addEventListener('click', function (e) {
|
|
if (!e.target.closest('.rpt-header')) {
|
|
nav.classList.remove('is-open');
|
|
btn.setAttribute('aria-expanded', 'false');
|
|
}
|
|
});
|
|
});
|
|
})();
|