0% found this document useful (0 votes)
3 views2 pages

Share Java

The document contains JavaScript code for a mobile navigation toggle feature that shows or hides the navigation menu when clicked. It also includes functionality for smooth scrolling to in-page links when they are clicked. The code ensures that the navigation menu closes when a link within it is selected.

Uploaded by

mandimatiliki
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)
3 views2 pages

Share Java

The document contains JavaScript code for a mobile navigation toggle feature that shows or hides the navigation menu when clicked. It also includes functionality for smooth scrolling to in-page links when they are clicked. The code ensures that the navigation menu closes when a link within it is selected.

Uploaded by

mandimatiliki
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

// Mobile nav toggle

const navToggle = [Link]("navToggle");

const navMenu = [Link]("navMenu");

if (navToggle && navMenu) {

[Link]("click", () => {

[Link]("show");

});

[Link]("a").forEach(link => {

[Link]("click", () => {

[Link]("show");

});

});

// Smooth scroll for in-page links

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

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

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

if ([Link] > 1) {

[Link]();

const target = [Link](targetId);

if (target) {

[Link]({
top: [Link] - 70,

behavior: "smooth"

});

});

});

You might also like