adrianhajdin / project_3D_developer_portfolio

The most impressive websites in the world use 3D graphics and animations to bring their content to life. Learn how to build your own ThreeJS 3D Developer Portfolio today!
https://jsmastery.pro
5.71k stars 1.26k forks source link

Toggle not working Navbar.jsx #104

Closed Harsh-Ojha closed 11 months ago

Harsh-Ojha commented 12 months ago
Screenshot 2023-08-31 131500

The toggle function is not working, and I am unable to close or open the list manually. Please suggest some solution.

Tusharknwl commented 11 months ago

@Harsh-Ojha you have to use ` ( backtick: the key to the left of the 1 in standard keyboards) instead of ' (single quote)

             <li
              key={Link.id}
              className={`${
                active === Link.title
                ? "text-white"
                : "text-secondary"
              } hover:text-white text-[18px] font-medium cursor-pointer`}
              onClick={()=> setActive(Link.title)}
              >
              <a href={`#${Link.id}`}>{Link.title}</a>
            </li>
Harsh-Ojha commented 11 months ago

@Harsh-Ojha you have to use ` ( backtick: the key to the left of the 1 in standard keyboards) instead of ' (single quote)

             <li
              key={Link.id}
              className={`${
                active === Link.title
                ? "text-white"
                : "text-secondary"
              } hover:text-white text-[18px] font-medium cursor-pointer`}
              onClick={()=> setActive(Link.title)}
              >
              <a href={`#${Link.id}`}>{Link.title}</a>
            </li>

Thanks @Tusharknwl, it worked for me.