0% found this document useful (0 votes)
6 views3 pages

Main Navigation Functionality

The document contains JavaScript code for enhancing website navigation functionality, including smooth scrolling for anchor links and a mobile menu toggle. It also adds an 'active' class to the current navigation item based on the page URL and includes a placeholder for project-specific functionality. Additionally, it initializes Power BI dashboard embedding upon page load.

Uploaded by

dedand418
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views3 pages

Main Navigation Functionality

The document contains JavaScript code for enhancing website navigation functionality, including smooth scrolling for anchor links and a mobile menu toggle. It also adds an 'active' class to the current navigation item based on the page URL and includes a placeholder for project-specific functionality. Additionally, it initializes Power BI dashboard embedding upon page load.

Uploaded by

dedand418
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

// Main navigation functionality

[Link]('DOMContentLoaded', function() {

// Smooth scrolling for navigation links

[Link]('a[href^="#"]').forEach(anchor => {

[Link]('click', function(e) {

[Link]();

const targetId = [Link]('href');

if (targetId === '#') return;

const targetElement = [Link](targetId);

if (targetElement) {

[Link]({

behavior: 'smooth'

});

});

});

// Mobile menu toggle (if you add one later)

const mobileMenuButton = [Link]('.mobile-menu-button');

if (mobileMenuButton) {

[Link]('click', function() {

const nav = [Link]('nav ul');

[Link]('active');

});
}

// Add active class to current navigation item

const currentPage = [Link]('/').pop() || '[Link]';

[Link]('nav ul li a').forEach(link => {

const linkPage = [Link]('href').split('/').pop() || '[Link]';

if (linkPage === currentPage) {

[Link]('active');

});

// Project page specific functionality

if ([Link]('projects/')) {

// Add any project-specific JavaScript here

[Link]('Project page loaded');

});

// Function to handle Power BI dashboard embedding

function embedPowerBIDashboard() {

// This would be replaced with actual Power BI embedding code

[Link]('Power BI dashboard embedded');

// Initialize any additional components

[Link]('DOMContentLoaded', embedPowerBIDashboard);

You might also like