@@ -1768,6 +1768,35 @@ <h3 class="modal-title">Need IT Job or Interview Support? We’re Here to Help!<
17681768 }
17691769
17701770 // Smooth scroll for anchor links
1771+ // document.querySelectorAll('a[href^="#"]').forEach(anchor => {
1772+ // anchor.addEventListener('click', function (e) {
1773+ // e.preventDefault();
1774+
1775+ // const targetId = this.getAttribute('href');
1776+ // const target = document.querySelector(targetId);
1777+
1778+ // if (target) {
1779+ // // Offset for sticky navbar
1780+ // const yOffset = -90; // adjust based on navbar height
1781+ // const y = target.getBoundingClientRect().top + window.pageYOffset + yOffset;
1782+
1783+ // window.scrollTo({
1784+ // top: y,
1785+ // behavior: 'smooth'
1786+ // });
1787+
1788+ // // Update URL hash 🔥 (THIS FIXES YOUR ISSUE)
1789+ // history.pushState(null, '', targetId);
1790+
1791+ // // Update active nav link
1792+ // document.querySelectorAll('.nav-link').forEach(link => {
1793+ // link.classList.remove('active');
1794+ // });
1795+ // this.classList.add('active');
1796+ // }
1797+ // });
1798+ // });
1799+
17711800 document . querySelectorAll ( 'a[href^="#"]' ) . forEach ( anchor => {
17721801 anchor . addEventListener ( 'click' , function ( e ) {
17731802 e . preventDefault ( ) ;
@@ -1776,27 +1805,34 @@ <h3 class="modal-title">Need IT Job or Interview Support? We’re Here to Help!<
17761805 const target = document . querySelector ( targetId ) ;
17771806
17781807 if ( target ) {
1779- // Offset for sticky navbar
1780- const yOffset = - 90 ; // adjust based on navbar height
1808+ const yOffset = - 90 ;
17811809 const y = target . getBoundingClientRect ( ) . top + window . pageYOffset + yOffset ;
17821810
17831811 window . scrollTo ( {
17841812 top : y ,
17851813 behavior : 'smooth'
17861814 } ) ;
17871815
1788- // Update URL hash 🔥 (THIS FIXES YOUR ISSUE)
17891816 history . pushState ( null , '' , targetId ) ;
17901817
1791- // Update active nav link
17921818 document . querySelectorAll ( '.nav-link' ) . forEach ( link => {
17931819 link . classList . remove ( 'active' ) ;
17941820 } ) ;
17951821 this . classList . add ( 'active' ) ;
1822+
1823+ // ✅ CLOSE MOBILE NAVBAR
1824+ const navbarCollapse = document . querySelector ( '.navbar-collapse' ) ;
1825+ if ( navbarCollapse . classList . contains ( 'show' ) ) {
1826+ const bsCollapse =
1827+ bootstrap . Collapse . getInstance ( navbarCollapse ) ||
1828+ new bootstrap . Collapse ( navbarCollapse , { toggle : false } ) ;
1829+ bsCollapse . hide ( ) ;
1830+ }
17961831 }
17971832 } ) ;
17981833 } ) ;
17991834
1835+
18001836 // Reveal on scroll animation
18011837 const observerOptions = {
18021838 threshold : 0.1 ,
0 commit comments