Skip to content

Functional Issue: Dynamic Navbar for Small Screens #21

@codeCraft-Ritik

Description

@codeCraft-Ritik

Issue:

While a menutoggle() function exists in main.js, it relies on a hardcoded maxHeight that might not accommodate future menu items, and the responsive styling in style.css is minimal.

File to edit: Ecommerce-Website/main.js

Change: Update the menutoggle function to dynamically calculate height or use a class toggle for better flexibility.

Code Addition:

function menutoggle() {
    const menu = document.getElementById("menu-items");
    // Toggle a class instead of manual height for better CSS control
    menu.classList.toggle("show-menu");

    // Alternative dynamic height logic
    if (menu.style.maxHeight === "0px" || menu.style.maxHeight === "") {
        menu.style.maxHeight = menu.scrollHeight + "px";
    } else {
        menu.style.maxHeight = "0px";
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions