Active Nav Link Indicator with Vanilla Javascript

Поделиться
HTML-код
  • Опубликовано: 25 июн 2021
  • Apply a class to the navigation link for the current page with a few lines of Javascript.
    Here's the JS: codepen.io/Coding-in-Public/p...
  • ХоббиХобби

Комментарии • 188

  • @gabrielfono844
    @gabrielfono844 Год назад +12

    I love the way that you explain things
    as software engineer, we all love simplicity.
    thanks for providing such high value to the community

    • @CodinginPublic
      @CodinginPublic  Год назад +2

      That’s very kind. Thanks for saying something!

  • @armandoWebDev
    @armandoWebDev Год назад +15

    The step by step explanation was really great! Thank you

  • @chooseyourtool
    @chooseyourtool 2 месяца назад

    FINALLY I found your video. I was so much looking for this. But other videos I found were so overcomplicated and missing the point. Thank you, very well done.

  • @siddharththapa4672
    @siddharththapa4672 Год назад +3

    this was the most simplest and on point tutorial on this topic.....much love from INDIA

  • @neelamchaubey28
    @neelamchaubey28 2 года назад +2

    Such an amazing and informative video! Thanks so much. I landed up on this channel through your videos on Shaun's channel. Glad I found it!

  • @Pookamensch
    @Pookamensch 6 месяцев назад

    I saw others solutions, but yours is the most simple and the most well explained of all! Thanks!!!

  • @princemalongo9303
    @princemalongo9303 Месяц назад

    Your code is see,simple to understand, and the presentation itself is so sweet.

  • @petersonokereke1634
    @petersonokereke1634 2 года назад

    Thanks so much for this amazing video. JavaScript has been after my life these past few weeks. This solved my problem

    • @CodinginPublic
      @CodinginPublic  2 года назад +1

      You’re welcome! Glad it was a help! I’ve got an update coming out soon, too!

  • @leonardmbibi8013
    @leonardmbibi8013 Год назад +9

    I found out I could use activePage = window.location.href and use strict equality operator to campare it to each "href" with the same results as yours. Your video just introduced me to Browser Object Model. Thanks a lot.

    • @CodinginPublic
      @CodinginPublic  Год назад

      Awesome! You're welcome. I also did a follow-up video that should help, too! ruclips.net/video/HpjW9eaFLIg/видео.html

  • @okaniedavis3551
    @okaniedavis3551 Год назад +6

    Perfect, exactly what I needed. Thank you!

    • @CodinginPublic
      @CodinginPublic  Год назад +2

      You’re welcome!

    • @claudiofernandes6430
      @claudiofernandes6430 10 месяцев назад

      Congratulations. This is the best solution that I found in the RUclips. Thank you very much.

  • @the-beauty-of-creativity2083
    @the-beauty-of-creativity2083 2 года назад +1

    Thank god I found this video. I lost sometime looking for this solution. Thanks Bro!

    • @CodinginPublic
      @CodinginPublic  2 года назад

      Awesome! So glad it was a help! Thanks for saying something!

  • @sarvesh6785
    @sarvesh6785 Год назад +2

    Thank you very much, sir! I was trying to find a solution for three hours, but none of them worked. Finally, this worked perfectly.

  • @darklordpassy5361
    @darklordpassy5361 Месяц назад

    You explained it so well and simple. Thank you!

  • @yanakochubynska5568
    @yanakochubynska5568 Год назад +1

    This video really helped a lot, thank you!

  • @pikkuk5693
    @pikkuk5693 2 года назад +1

    it is so awesome and easy to understand which anyone never told me this video deserve more likes

    • @CodinginPublic
      @CodinginPublic  2 года назад

      Glad it was a help! Thanks for saying something!

  • @ingridsantos1143
    @ingridsantos1143 Год назад +1

    Thanks so much. This tutorial was really helpful and well explained.

  • @salmaenassiri3344
    @salmaenassiri3344 9 месяцев назад +1

    Thank youuuu I struggled a loot with this so thank you 🎉🎉

  • @akshayshinde2403
    @akshayshinde2403 2 года назад +5

    basically we are highlighting that navlink to which it belongs, its that simple. I will use this forever.

  • @choanlpoto
    @choanlpoto 2 года назад +1

    Thanks a lot. I thought having an active link status was super easy like 1 css pseudo elements lol. . I found no good tuto on how to do it. Nothing worked until yours. Awsome Channel subbed. Thx.

    • @CodinginPublic
      @CodinginPublic  2 года назад +1

      So glad it was a help! Thanks for saying something!

  • @maisha-safari
    @maisha-safari Месяц назад

    You are an excellent teacher, thank you.

  • @rajkiranchaudhary8769
    @rajkiranchaudhary8769 2 года назад +2

    Thanks a lot for this amazing content.

  • @makidelavega3079
    @makidelavega3079 2 года назад +1

    Thanks for this video ,it helped me a lot.

  • @cheesychains
    @cheesychains 2 года назад +1

    This saved me, thank you so much!

  • @hexd7439
    @hexd7439 2 года назад +1

    Thanks a lot! This tutorial helped me.

  • @RJ-gj1zv
    @RJ-gj1zv 2 года назад +1

    Thanks, man. absolutely brilliant

  • @kllokoq
    @kllokoq Год назад +6

    This is probably the easiest way I've seen of adding an active class. Instead of going and removing the class from the previously selected link, it skips all that non-sense.Lovely!

    • @CodinginPublic
      @CodinginPublic  Год назад

      Glad it was a help!

    • @muhammedibrahem5100
      @muhammedibrahem5100 Год назад +1

      He doesn't have to remove the class because the page does refresh on each click, so the class is being removed already once he clicks any of the buttons,
      The solution u are saying is for the same page buttons without any refreshes, at this moment u gotta remove the class then add it to the new clicked button

  • @efieugenia
    @efieugenia Год назад +1

    What a wonderful tutorial

  • @cesarpacheco9155
    @cesarpacheco9155 Год назад +1

    Profesor muchas gracias por este video me sirvio de mucho saludos desde Colombia

  • @dadwalkanishka9210
    @dadwalkanishka9210 7 месяцев назад

    thanks for the code it was helpful for me

    • @CodinginPublic
      @CodinginPublic  7 месяцев назад

      So glad! Thanks for taking the time to say something!

  • @chriswesleypierre1440
    @chriswesleypierre1440 5 месяцев назад

    precise, quick, useful

  • @mohamed_younes77
    @mohamed_younes77 11 месяцев назад

    thx man very simlpe and clear

  • @kamaboko1
    @kamaboko1 9 месяцев назад

    Superb explanation.

  • @rjw66
    @rjw66 2 года назад +1

    Very helpful!

    • @CodinginPublic
      @CodinginPublic  2 года назад

      Good to hear! Thanks for saying something!

  • @juanalmonte1642
    @juanalmonte1642 2 года назад +1

    Good and easy to understand

  • @Steve-rx4sw
    @Steve-rx4sw 2 года назад +1

    good work bro. thanks

    • @CodinginPublic
      @CodinginPublic  2 года назад

      glad it was a help! Thanks for saying something!

  • @ak-yo6pf
    @ak-yo6pf Год назад +1

    you are a g thanks for that!

  • @ankitmakwana3141
    @ankitmakwana3141 2 года назад +1

    awsm great!!

  • @alphamx13
    @alphamx13 7 месяцев назад

    Great! Just one question... how can you also add the active class to the menu section if you scroll down or up the page ? Thank U!

    • @CodinginPublic
      @CodinginPublic  6 месяцев назад +1

      I’ve done a tutorial like this a long time ago, but not finding it right now. Sorry!

  • @nigelpallatt
    @nigelpallatt 2 года назад +1

    BRILLIANT THANK YOU!

    • @CodinginPublic
      @CodinginPublic  2 года назад +1

      Awesome! Glad you liked it!

    • @nigelpallatt
      @nigelpallatt 2 года назад

      @@CodinginPublic Sort of had a typo on the first try, but it works lovely now, I'll be using this from now on all my sites, Thank you again and great work!

    • @CodinginPublic
      @CodinginPublic  2 года назад

      👀

  • @sokcheahong1468
    @sokcheahong1468 Год назад +1

    really helpful

    • @CodinginPublic
      @CodinginPublic  Год назад

      Thanks for saying something. Glad it was a help!

  • @sbf.2189
    @sbf.2189 10 месяцев назад

    Thank you so much man

  • @asidermakriver
    @asidermakriver 2 года назад +1

    Thank you!

    • @CodinginPublic
      @CodinginPublic  2 года назад

      You’re welcome! Thanks for saying something!

  • @RuiOut8
    @RuiOut8 2 года назад +3

    Thank you! This is really helpful! Does this concept work for one page websites where the Nav links to IDs within the same HTML file?

    • @CodinginPublic
      @CodinginPublic  2 года назад +2

      You’re welcome! For IDs on a one-page site it’s even easier! You can use the :target pseudo selector to apply styles to the nav links using only CSS!

    • @RuiOut8
      @RuiOut8 2 года назад

      @@CodinginPublic awesome! Thank you very much!

  • @wtfmomentninenine
    @wtfmomentninenine 9 месяцев назад

    thank you, sir

  • @codingislife6387
    @codingislife6387 Год назад

    thanks Sir Jee. It Very Help Full Thanks .

  • @lordilhamgod4417
    @lordilhamgod4417 Год назад

    Works well!! DANKEEE

  • @salmajahan5834
    @salmajahan5834 Месяц назад

    Thank you so much, super like

  • @Dontmesswithmeplease
    @Dontmesswithmeplease Год назад +1

    Super

  • @Ganito55
    @Ganito55 Год назад +2

    Hi!, amazing stuff! Is it easy to stop page refresh? Maybe using ajax/fetch? Many thanks

  • @pbt4820
    @pbt4820 3 месяца назад

    thank you for the vid. I am trying to have the viewed page underlined instead of highlight with black blocks. is that possible with this method?

    • @CodinginPublic
      @CodinginPublic  3 месяца назад

      Sure! Just switch up the CSS. I'd make it have a transparent underline (border-bottom) when not selected and then just the color you want when it is selected.

  • @ricardodelacrvz1400
    @ricardodelacrvz1400 Год назад

    thank you for this tuto. I actually had to use window.location.href instead of pathname since Im using different slugs to the same pathname between product categorys in php.

    • @CodinginPublic
      @CodinginPublic  Год назад

      Yes! I ended up updating the video later to something much better here :) ruclips.net/video/HpjW9eaFLIg/видео.html

  • @footballcorner6
    @footballcorner6 8 месяцев назад

    Thank you so much

  • @moneyfr
    @moneyfr 2 года назад +1

    Do you know how make dynamic navbar (all forder page show into navebare) for each li maybe?

    • @CodinginPublic
      @CodinginPublic  2 года назад

      I’m not sure I understand? Here is a video I did on navbars recently though. Hopefully that helps.
      ruclips.net/video/63sxOYm9GwY/видео.html

  • @brucewernick6542
    @brucewernick6542 3 месяца назад

    You put a forward slash in front of the anchor links. So, when running in a browser, this makes it try to find the file in the root directory. I removed this forward slash and it works in browser and the local web server.

  • @itszeynepk
    @itszeynepk Год назад

    thank you so much

    • @CodinginPublic
      @CodinginPublic  Год назад

      You’re welcome! Thanks for saying something!

  • @Rahul-ur6xz
    @Rahul-ur6xz Год назад +1

    What Editor Do You Use ?

    • @CodinginPublic
      @CodinginPublic  Год назад

      I think I was using Nova in this video, but I use VSCode now.

  • @luciaholubova7504
    @luciaholubova7504 Год назад +1

    Hi How do I get the content stay on the page, instead of taking me to new page with using anchor?

    • @CodinginPublic
      @CodinginPublic  Год назад

      Anchor links can take you to any element on the page with an ID. It takes two steps:
      1. Create a page element with an ID. Like this…
      Hi, I’m a link!
      2. Point the href of an anchor tag to that ID. like this…
      Click to jump
      (Note the #)
      Whenever you click the link, it’ll jump to that ID on the page.

  • @andrewlawton2487
    @andrewlawton2487 2 года назад +1

    Thank you very much for the video. I implemented your code accordingly and experiencing one issue I'd greatly appreciate your assistance with. When I click the nav home link all the links become active and I'm not sure why? Looking at the console.log it shows all path names not just the home page index.html. Thank you in advance for your help.

    • @CodinginPublic
      @CodinginPublic  2 года назад

      Glad it was a help! Hmm…I’m guessing you’re in a directory? Like…www.website/temp/
      If that’s the case, all links in your nav links will include the directory (“temp” in this example).
      Go to your home page and console.log(window.location.pathname)
      Assuming that’s the problem it will include the directory and you can remove it by using the substring method.
      If that’s not clear or doesn’t work, feel free to drop a link to a GitHub or something or DM on Twitter at cpenned.

    • @andrewlawton2487
      @andrewlawton2487 2 года назад

      @@CodinginPublic Thank you for your quick reply Chris. I will let you know if your suggestion works. Thanks again!

  • @usef439
    @usef439 Год назад

    Thanks!

    • @CodinginPublic
      @CodinginPublic  Год назад

      You’re welcome! Thanks for saying something!

  • @adrian20065
    @adrian20065 2 года назад +1

    Thanks a lot for this tutorial! I recently came across you channel and subscribed. How can you keep the parent active is it has children? Thanks again!

    • @CodinginPublic
      @CodinginPublic  2 года назад

      Thanks so much! Just to make sure I understand, are you wanting to keep the parent active if it has a submenu?

    • @adrian20065
      @adrian20065 2 года назад

      @@CodinginPublic Yes, I want to keep the parent active if it has a submenu. Thanks for the quick reply.

    • @CodinginPublic
      @CodinginPublic  2 года назад

      Just saw today that RUclips blocked your reply and never notified me. Sorry! You still need help?

    • @adrian20065
      @adrian20065 2 года назад

      @@CodinginPublic Yes, I still like to know how to keep the parent menu item active when the child menu item is selected. Thank you.

  • @behold_a_son
    @behold_a_son 2 года назад +1

    Is there a need to synchronize the desktop navbar active states to mobile navbar active states if both the styles are different? Meaning If I click the mobile nav link. The same link in the desktop nav should be active and vice versa. I spent a lot of time and accomplished this in a practice problem but I'm worried that it was not worth the effort.

    • @CodinginPublic
      @CodinginPublic  2 года назад +1

      Thanks for the comment. Hmm…assuming you have the desktop/mobile nav bar set to display:none whenever it's not showing, it shouldn't matter. If they're both rendered and you set them both to active, that would cause some accessibility issues, I believe. FWIW, I usually only have one nav that I just style differently depending on viewport width (example: ruclips.net/video/63sxOYm9GwY/видео.html), so I usually don't run into your question.

    • @behold_a_son
      @behold_a_son 2 года назад

      @@CodinginPublic Thank you, that's insightful!

  • @jivara5523
    @jivara5523 4 месяца назад

    ty very much

  • @RohitSharma-wq4ok
    @RohitSharma-wq4ok Год назад +2

    Sir on home page it apply to all links active class and on console it show active 5 link in only on home page

    • @CodinginPublic
      @CodinginPublic  Год назад +1

      On some sites that's the case. Did an update that fixes that an a few other issues :) ruclips.net/video/HpjW9eaFLIg/видео.html

  • @suresranathunga
    @suresranathunga Год назад

    💙💙

  • @yofi2614
    @yofi2614 Год назад

    Great tutorial, so clear and plesant to here, thank!
    One quick question,
    let say you click the home button and it gets the active class,
    But what remove this class in next rounds?
    Logically it should have left this class on every button that had been clicked so eventually if you click all the buttons all of them will be black

    • @CodinginPublic
      @CodinginPublic  Год назад

      Glad it was a help! Because you’re applying the class using client-side JavaScript, the class will be removed each time you change to a different page. Once you arrive on the next page, you can apply the class again for the current page you’re on at that time. Does that make sense?
      I’ve actually updated my process for applying active links here: ruclips.net/video/HpjW9eaFLIg/видео.html

    • @yofi2614
      @yofi2614 Год назад

      @@CodinginPublic totally makes sense cause i haven't learnt client side js yet, but i will look up at the link you gave, so much thankful for the quick respond! Subscribed!

    • @CodinginPublic
      @CodinginPublic  Год назад

      You’re welcome! Client-side JavaScript means JavaScript that the site visitor’s browser runs (so like the JavaScript we wrote in this video). In other words, it’s only applied once the page loads. Hopefully that helps some. Thanks for the sub!

    • @yofi2614
      @yofi2614 Год назад

      @@CodinginPublic thanks!

  • @connorbyram3649
    @connorbyram3649 Год назад +2

    This is a wonderful solution. I was having an issues where ALL of my nav links had the active class added to them- because I am utilizing a directory. To skirt this I came up with this: By directly/strictly comparing the window href and the link href, there is only one possible match.
    document.querySelectorAll('.nav-links a').forEach(link => {
    if(link.href === window.location.href) {
    link.classList.add('active');
    }
    });

    • @CodinginPublic
      @CodinginPublic  Год назад

      Great! Yeah, I updated this video here to work the way it SHOULD have worked. :) ruclips.net/video/HpjW9eaFLIg/видео.html

    • @ylitandi
      @ylitandi Год назад

      Thank you very much ! So the code is : const activePage = window.location.pathname;
      const navLinks = document.querySelectorAll('.nav-links a').forEach(link => {
      if(link.href === window.location.href){
      link.classList.add('active');
      console.log(link);
      }
      }); ??? 🙂

    • @connorbyram3649
      @connorbyram3649 Год назад

      @@ylitandi I will have to look back at my code. But that should work. Have you demoed it? Also, there's no need for that console.log(link).

  • @nazmussakib9346
    @nazmussakib9346 7 месяцев назад

    Hey brother, I need some help... Please reply to my comment... I applied this JavaScript on my blogger blog... Everything's perfect but when I'm on the home page the active class is added to all of the links instead of adding to only the home page link... Why is this happening?

    • @CodinginPublic
      @CodinginPublic  7 месяцев назад

      Fixed in this video :)
      ruclips.net/video/HpjW9eaFLIg/видео.html

  • @sydneysolomon5500
    @sydneysolomon5500 Год назад

    Hi, I am looking for a tutorial, when you click Home button or any other it takes you the information that is the particular button. Do u have such a tutorial?

    • @CodinginPublic
      @CodinginPublic  Год назад

      Do you mean anchor links?

    • @sydneysolomon5500
      @sydneysolomon5500 Год назад

      @@CodinginPublic Yes...example if you click on the HOME button it should take you whatever is the text about NOME. Same for all the other buttons.

    • @CodinginPublic
      @CodinginPublic  Год назад

      @@sydneysolomon5500 Been a long time since I did this, but I think this is along the lines of what you want? ruclips.net/video/PolXp-MWJcs/видео.html

  • @okaniedavis3551
    @okaniedavis3551 Год назад

    Is there a way to do this for sub links in a side panel inside a parent link, like a tree, To make the parent link remain open displaying child/sub links? Is there a video that can help me?

    • @CodinginPublic
      @CodinginPublic  Год назад +1

      There is a way to do this; not sure about a video? I haven't done one. Sorry! :)

    • @okaniedavis3551
      @okaniedavis3551 Год назад

      @@CodinginPublic After all, this video was also enough to achieve what I wanted with my parent and child links. Thank you 👌

  • @kimkorngmao
    @kimkorngmao Год назад +1

    hi, My problem is when in the url doesn't have "index.html", It active for all the link. what should is do?

    • @CodinginPublic
      @CodinginPublic  Год назад +1

      Yes, I’ve done a more recent tutorial on the same topic to address this problem. Hope it helps!
      ruclips.net/video/HpjW9eaFLIg/видео.html

    • @kimkorngmao
      @kimkorngmao Год назад

      Thanks for that 😘

  • @Dontmesswithmeplease
    @Dontmesswithmeplease Год назад +1

    YOu are king, :) . Alexander the great

  • @ankurdohare2261
    @ankurdohare2261 Год назад +1

    what if first page is "/" instead of "/index.html" ? we cannot use link.hred.include in that case

    • @CodinginPublic
      @CodinginPublic  Год назад +1

      I did this follow up video with that in mind: ruclips.net/video/HpjW9eaFLIg/видео.html
      Hope that helps!

    • @ankurdohare2261
      @ankurdohare2261 Год назад

      @@CodinginPublic you are god😍, Thank you. I resolved one of the story at my firm . Thanks a lot🥳🥳🥳

    • @ankurdohare2261
      @ankurdohare2261 Год назад

      @@CodinginPublic Thanks for replying that fast 😁

  • @AlThePal78
    @AlThePal78 Год назад

    i wish you had the css for this too on your code pen but still n awesome vid

    • @CodinginPublic
      @CodinginPublic  Год назад +1

      Yeah, sorry 😞. This was before I was saving all code from my videos I think

    • @AlThePal78
      @AlThePal78 Год назад

      @@CodinginPublic that is okay I am stealing this and making my own video lol I will add a secondary class called link so I can add an underline and change the backgrouind color etc.. thanks so much :)

  • @sal-so2rw
    @sal-so2rw Год назад +2

    What's happening I can't see things clearly

    • @CodinginPublic
      @CodinginPublic  Год назад

      It's highlighting the active page link in the nav bar. Is that what you're asking?

  • @sebastianszydlowski5834
    @sebastianszydlowski5834 2 года назад +1

    This function adds active class to all links when websote is visited for the forst time. How can I remove this class?

    • @CodinginPublic
      @CodinginPublic  2 года назад

      Hmm. It shouldn’t. Happy to view your code and give you a solution. Feel free to DM on Twitter or share a public link.

    • @CodinginPublic
      @CodinginPublic  2 года назад

      Hey! I saw you commented, but RUclips deleted it before I could see it. 🙄 feel free to try again or DM me on Twitter at @cpenned.

    • @CodinginPublic
      @CodinginPublic  2 года назад

      Okay, so it deleted it, but the preview showed me enough! Ha. The problem is your window.location.pathname will include the directory (/wordpress/) and since your homepage includes that pathname and all four links include that section in their pathname, they're all highlighted.
      My initial thought is that you should just clip out the "/wordpress/" from the pathname, which you can do with the substring method (assuming all your menu items will always be in that directory, wordpress). The substring takes a number as an argument and basically slices off those indexes from your string.
      So in all, change …
      const activePage = window.location.pathname;
      to …
      const activePage = window.location.pathname.substring(10);
      ---
      Let me know if that doesn't make sense or doesn't solve your problem.

    • @sebastianszydlowski5834
      @sebastianszydlowski5834 2 года назад

      @@CodinginPublic Thank you for the reply. Did not work. I noticed it for the first time when the site was on localhost. I will let you know if it is working after migration.

    • @CodinginPublic
      @CodinginPublic  2 года назад

      @@sebastianszydlowski5834 Ah-sorry you're still having trouble with it. For what it’s worth, I used the solution I mentioned in your live site (just changed the JS file) and it worked properly in my tests, but it all depends on the folder structure. Happy to help more if it would be a help.

  • @MaksymMinenko
    @MaksymMinenko Год назад

    The codepen has only the JS file...

    • @CodinginPublic
      @CodinginPublic  Год назад

      Well, because every site is so different and the focus was on implementing the JS for any page. Let me know if you get stuck. Happy to help!

  • @subscribetoDerickChess
    @subscribetoDerickChess Год назад

    can you show me what you used for the html thx

    • @CodinginPublic
      @CodinginPublic  Год назад

      Sorry! I didn't save the code for this; just whatever’s in the code pen!

    • @subscribetoDerickChess
      @subscribetoDerickChess Год назад

      @@CodinginPublic it doesn't work?
      and are lists

    • @CodinginPublic
      @CodinginPublic  Год назад

      @@subscribetoDerickChess I show the HTML in the video at @0:59 hope that helps!

  • @ggff8782
    @ggff8782 Год назад +1

    Not hover before clicking

    • @CodinginPublic
      @CodinginPublic  Год назад

      not sure I understand? Did I style it wrong? I can’t remember-this has been a while :)

  • @MuhammadAdnan2.0
    @MuhammadAdnan2.0 Год назад

    Bro what about these slugs contact%20Us ?

    • @CodinginPublic
      @CodinginPublic  Год назад +1

      Did a follow-up video for these types of situations :) ruclips.net/video/HpjW9eaFLIg/видео.html

    • @MuhammadAdnan2.0
      @MuhammadAdnan2.0 Год назад

      @@CodinginPublic great thnx

  • @SharoAliDevelpor
    @SharoAliDevelpor Год назад +1

    Wow i need it but plz provide the source code

  • @surbhipaliwal3576
    @surbhipaliwal3576 2 года назад +1

    Sir please give all files

  • @beautifularabicnasheed2323
    @beautifularabicnasheed2323 2 года назад

    code plase

  • @MrFreak0r
    @MrFreak0r 10 месяцев назад

    Easier way with just 2 lines of CSS:
    .current-menu-item a {
    color: #FFFFFF !important;
    background: #2889AE !important;
    }
    So much useless stuff with all the html and javascript. I don't want to hack into the pentagn, just make the active menu item highlighted....

    • @CodinginPublic
      @CodinginPublic  10 месяцев назад

      This is such a long time ago I’m sure I’d do it differently than however I did it in this video. Just be careful about those !important flags. They can get you into trouble :)
      I’d also consider using the aria-current=“page” attribute instead of a class to make this more accessible.